/* =========================================================
   Pricing Calculator — modern light RTL UI (2026)
   ========================================================= */

:root {
  --bg-top: #eef4f8;
  --bg-bottom: #f7f5f1;
  --surface: #ffffff;
  --surface-soft: #f4f7fa;
  --ink: #1a2332;
  --ink-muted: #5a6a7d;
  --border: #d9e2ec;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --accent-ink: #115e59;
  --warning-soft: #fff7ed;
  --shadow: 0 10px 30px rgba(26, 35, 50, 0.06);
  --shadow-sm: 0 2px 8px rgba(26, 35, 50, 0.04);
  --radius: 18px;
  --radius-sm: 12px;
  --font-body: "Assistant", "Segoe UI", Tahoma, sans-serif;
  --font-display: "Rubik", "Assistant", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, #d7ece8 0%, transparent 55%),
    radial-gradient(900px 500px at -10% 110%, #e8e2d6 0%, transparent 50%),
    linear-gradient(165deg, var(--bg-top), var(--bg-bottom));
  line-height: 1.55;
}

.page {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.25rem 0 3.5rem;
}

.page-header {
  margin-bottom: 1.75rem;
  animation: fadeUp 0.55s var(--ease) both;
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3.5vw, 2.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0.45rem 0 0;
  color: var(--ink-muted);
  font-size: 1.05rem;
}

.products-tabs {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.35rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.tab-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
}

.tab-btn[aria-selected="true"] {
  color: var(--accent-ink);
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.sub-tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.55rem 0.55rem 0.35rem;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  box-shadow: none;
}

.sub-tabs-nav[hidden] {
  display: none !important;
}

.sub-tab-btn {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  padding: 0.5rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.sub-tab-btn:hover {
  color: var(--ink);
  background: #eaf1f6;
}

.sub-tab-btn[aria-selected="true"] {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: #99f6e4;
}

.tabs-panels {
  display: block;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.35rem 1.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  animation: fadeUp 0.45s var(--ease) both;
  max-width: 100%;
}

.product-card[hidden] {
  display: none !important;
}

.product-card__head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.product-card__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.35;
}

.product-card__desc {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.meta-chip {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
}

.product-note {
  margin: 0;
  padding: 0.65rem 0.85rem;
  background: var(--warning-soft);
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  color: #9a3412;
  font-size: 0.88rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.field--checkbox input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  min-height: 0;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.field--checkbox label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.field[hidden] {
  display: none !important;
}

.field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
  appearance: none;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a6a7d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.85rem center;
  padding-left: 2.4rem;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.dynamic-fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.dynamic-fields[hidden] {
  display: none !important;
}

.result-panel {
  margin-top: auto;
  background: linear-gradient(180deg, #f8fbfb, #eef7f5);
  border: 1px solid #d5e8e4;
  border-radius: var(--radius-sm);
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.92rem;
  color: var(--ink-muted);
}

.result-row strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.result-total {
  margin-top: 0.25rem;
  padding-top: 0.7rem;
  border-top: 1px dashed #c5ddd8;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.result-total span {
  font-weight: 600;
  color: var(--accent-ink);
}

.result-total strong {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  transition: transform 0.25s var(--ease), color 0.25s var(--ease);
}

.result-total strong.pulse {
  animation: pricePulse 0.45s var(--ease);
}

.breakdown {
  margin: 0.15rem 0 0;
  padding: 0.7rem 0.8rem;
  background: var(--warning-soft);
  border-radius: 10px;
  color: #7c4a1a;
  font-size: 0.86rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

.breakdown[hidden] {
  display: none !important;
}

.price-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  min-width: 420px;
}

.price-table th,
.price-table td {
  padding: 0.75rem 0.9rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.price-table thead th {
  background: #e8f1ef;
  color: var(--accent-ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.price-table tbody tr:last-child td {
  border-bottom: none;
}

.price-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.65);
}

.price-table tbody tr:hover {
  background: var(--accent-soft);
}

.price-table__total {
  font-weight: 700;
  color: var(--accent);
}

.summary-card {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem 1.4rem;
  animation: fadeUp 0.65s var(--ease) both;
  animation-delay: 0.16s;
}

.summary-title {
  margin: 0 0 0.9rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.summary-lines {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 1.5rem;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--ink-muted);
  font-size: 0.98rem;
}

.summary-line strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.summary-empty {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.summary-divider {
  height: 1px;
  background: var(--border);
  margin: 0.95rem 0;
}

.summary-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.05rem;
  font-weight: 600;
}

.summary-total {
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  transition: transform 0.25s var(--ease);
}

.summary-total.pulse {
  animation: pricePulse 0.45s var(--ease);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pricePulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); color: var(--accent-ink); }
  100% { transform: scale(1); }
}

@media (max-width: 680px) {
  .page {
    width: min(100% - 1.25rem, 1120px);
    padding-top: 1.5rem;
  }

  .tabs-nav,
  .sub-tabs-nav {
    flex-direction: column;
  }

  .tab-btn,
  .sub-tab-btn {
    flex: 1 1 auto;
    text-align: right;
    font-size: 0.92rem;
  }

  .field input,
  .field select {
    min-height: 52px;
    font-size: 1.05rem;
  }

  .result-total strong {
    font-size: 1.6rem;
  }
}
