/*
  صفحه ماشین حساب: بعد از style.css لود می‌شود و فقط روی body.calc-page اثر دارد.
*/

.calc-page {
  --navy: #00254b;
  --navy-dark: #001421;
  --green: rgb(2, 145, 2);
  --green-dark: rgb(1, 118, 1);
  --green-bright: #2ece02;
  --line: #d9dfe5;
  --muted: #667085;
}

/* ---------- باند بالای صفحه (هم‌رنگ هدر سایت) ---------- */
.calc-hero {
  background:
    linear-gradient(rgba(0, 0, 0, 0.7), rgba(1, 41, 105, 0.4)),
    url("../images/header-img.jfif");
  background-position: center;
  background-size: cover;
  color: #fff;
  text-align: center;
  padding: 44px 20px 104px;
}
.calc-hero h1 {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 4px;
}
.calc-hero p {
  font-size: 15px;
  color: #d5dde8;
  max-width: 36ch;
  margin: 0 auto;
}

/* ---------- کارت ماشین حساب ---------- */
.calc-page main {
  max-width: 520px;
  margin: -68px auto 40px;
  padding: 0 16px;
  position: relative;
  margin-bottom: 60px;
}
.calc-card {
  background: #fff;
  border-radius: 18px;
  padding: 26px 24px 24px;
  box-shadow: 0 14px 44px rgba(0, 20, 60, 0.2);
}

/* ---------- فیلدها ---------- */
.field + .field {
  margin-top: 20px;
}
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #344054;
  margin-bottom: 8px;
}
.control {
  display: flex;
  align-items: stretch;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.control:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(2, 145, 2, 0.14);
}
.control input,
.control select {
  flex: 1;
  min-width: 0;
  height: 54px;
  font: inherit;
  font-size: 18px;          /* حداقل ۱۶ تا در iOS زوم نشود */
  font-weight: 600;
  color: #111;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0 16px;
}
.control input {
  text-align: right;
}
.control input::placeholder {
  color: #a3acb9;
  font-weight: 400;
}
.control .suffix {
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: #f3f5f8;
  border-right: 1px solid var(--line);
  color: #475467;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.control select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-left: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5l6 6 6-6' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 16px center;
}
.field-error {
  min-height: 0;
  margin-top: 6px;
  font-size: 13px;
  color: #c62828;
}
.field-error:empty {
  display: none;
}
.control input[aria-invalid="true"] {
  color: #c62828;
}

/* ---------- قیمت لحظه‌ای ---------- */
.price-row {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f4f7fa;
}
.price-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.price-label {
  font-size: 13.5px;
  color: var(--muted);
}
.price-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}
.price-value small {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}
.price-status {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.price-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aab1ba;
  flex: none;
}
.price-status[data-state="live"]::before { background: #1db954; }
.price-status[data-state="cached"]::before { background: #f5a623; }
.price-status[data-state="error"]::before { background: #d62828; }

/* ---------- دکمه ---------- */
.calc-btn {
  width: 100%;
  height: 56px;
  margin-top: 24px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(45deg, var(--green-dark), #04a304);
  box-shadow: 0 6px 16px rgba(2, 145, 2, 0.28);
  transition: filter .15s ease, transform .05s ease;
}
.calc-btn:hover {
  filter: brightness(1.06);
}
.calc-btn:active {
  transform: translateY(1px);
}
.calc-btn:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
}

/* ---------- نتیجه ---------- */
.calc-result {
  margin-top: 20px;
  padding: 24px 18px;
  text-align: center;
  color: #fff;
  border-radius: 14px;
  background: linear-gradient(45deg, var(--navy-dark), var(--navy));
  box-shadow: 0 8px 22px rgba(0, 37, 75, 0.25);
  animation: result-in .25s ease;
}
.calc-result[hidden] {
  display: none;
}
.res-label {
  font-size: 14px;
  color: var(--green-bright);
}
.res-value {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.4;
  margin: 6px 0 4px;
  word-break: break-word;
}
.res-note {
  font-size: 13px;
  color: #c9d3de;
}
@keyframes result-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- موبایل ---------- */
@media (max-width: 520px) {
  .calc-hero {
    padding: 32px 16px 96px;
  }
  .calc-hero h1 {
    font-size: 26px;
  }
  .calc-card {
    padding: 20px 16px 18px;
    border-radius: 16px;
  }
  .res-value {
    font-size: 28px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .calc-result { animation: none; }
  .control, .calc-btn { transition: none; }
}

/* ---------- تبدیل ارز به ارز ---------- */
.conv-card {
  margin-top: 48px;
}
.conv-title {
  margin: 0 0 4px;
  font-size: 20px;
  color: var(--navy-dark, #00254b);
}
.conv-sub {
  margin: 0 0 20px;
  font-size: 13px;
  color: #667085;
}
.swap-btn {
  display: block;
  width: 44px;
  height: 44px;
  margin: 14px auto -6px;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  color: var(--navy-dark, #00254b);
  background: #f3f5f8;
  border: 1px solid #d8dee6;
  border-radius: 50%;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.swap-btn:hover {
  background: #e6ebf1;
  transform: rotate(180deg);
}
.swap-btn:focus-visible {
  outline: 3px solid var(--navy, #00254b);
  outline-offset: 3px;
}
.conv-card .calc-result {
  margin-top: 24px;
}
