@font-face {
  font-family: 'Dana';
  src: url('../fonts/Dana-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Dana';
  src: url('../fonts/Dana-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
}

@font-face {
  font-family: 'Dana';
  src: url('../fonts/Dana-DemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
}

@font-face {
  font-family: 'Dana';
  src: url('../fonts/Dana-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
}

:root {
  --bg: #07111f;
  --bg-soft: #0e1b31;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --surface-muted: #f4f7fb;
  --text: #0f172a;
  --text-soft: #475569;
  --text-on-dark: #e2e8f0;
  --primary: #0f62fe;
  --primary-strong: #0a4de0;
  --primary-soft: rgba(15, 98, 254, 0.12);
  --danger: #dc2626;
  --danger-strong: #b91c1c;
  --border: rgba(148, 163, 184, 0.24);
  --border-strong: rgba(148, 163, 184, 0.38);
  --shadow-lg: 0 30px 80px rgba(2, 8, 23, 0.28);
  --shadow-md: 0 20px 50px rgba(15, 23, 42, 0.12);
  --shadow-sm: 0 10px 25px rgba(15, 23, 42, 0.08);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  direction: rtl;
  margin: 0;
  min-height: 100vh;
  font-family: 'Dana', Tahoma, sans-serif;
  font-feature-settings: "ss01" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.24), transparent 28%),
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.2), transparent 26%),
    linear-gradient(180deg, #08111f 0%, #0c1730 55%, #101b35 100%);
  color: var(--text);
}

img {
  max-width: 100%;
  display: block;
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
.close-btn:focus-visible {
  outline: 3px solid rgba(96, 165, 250, 0.45);
  outline-offset: 3px;
}

.page-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 28%),
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.06), transparent 18%);
}

.hero,
.page-shell {
  position: relative;
  z-index: 1;
}

.hero {
  padding: 20px 20px 8px;
}

.hero-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px 4px;
}

.eyebrow,
.section-kicker,
.popup-kicker {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow,
.section-kicker {
  color: rgba(191, 219, 254, 0.92);
}

.main-title {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(2.25rem, 4.2vw, 4.5rem);
  line-height: 1.22;
  font-weight: 700;
}

.hero-subtitle {
  max-width: 640px;
  margin: 10px 0 0;
  color: rgba(226, 232, 240, 0.88);
  font-size: clamp(1.08rem, 2vw, 1.2rem);
  line-height: 1.95;
  font-weight: 500;
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 20px;
}

.calculator-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.96)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.44));
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.calculator-card::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(15, 98, 254, 0.12), transparent 68%);
  pointer-events: none;
}

.card-heading,
.content-grid,
.result-panel {
  position: relative;
  z-index: 1;
}

.card-heading {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.card-heading h2,
.panel-header h3,
.popup-content h3 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.45rem, 2vw, 2.1rem);
  line-height: 1.45;
  font-weight: 700;
}

.section-description,
.panel-header p,
.popup-text {
  margin: 6px 0 0;
  color: var(--text-soft);
  line-height: 1.9;
  font-size: 0.98rem;
  font-weight: 500;
}

.content-grid {
  display: grid;
  gap: 24px;
  margin-top: 18px;
}

.form-panel,
.insight-panel,
.result-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.form-panel,
.insight-panel {
  padding: 18px;
}

.panel-header {
  margin-bottom: 16px;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.5;
  font-weight: 600;
}

.field-helper {
  color: var(--text-soft);
  font-size: 0.94rem;
  line-height: 1.85;
  font-weight: 500;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1.5px solid rgba(71, 85, 105, 0.36);
  border-radius: var(--radius-sm);
  background: #fcfdff;
  color: var(--text);
  padding: 0 14px;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease,
    background-color 0.2s ease;
}

input::placeholder {
  color: #64748b;
}

input:hover {
  border-color: rgba(51, 65, 85, 0.52);
  background: #ffffff;
}

input:focus {
  border-color: rgba(15, 98, 254, 0.78);
  box-shadow: 0 0 0 4px rgba(15, 98, 254, 0.16);
  transform: translateY(-1px);
  background: #ffffff;
}

.button-row {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  padding: 0 18px;
  font-size: 1rem;
  font-weight: 600;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease,
    background-color 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.processing {
  background: linear-gradient(135deg, var(--primary), #2b7fff);
  color: #fff;
  box-shadow: 0 16px 32px rgba(15, 98, 254, 0.22);
}

.processing:hover {
  background: linear-gradient(135deg, var(--primary-strong), #2269e6);
}

.danger {
  background: #fff5f5;
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.14);
}

.danger:hover {
  background: #fee2e2;
  color: var(--danger-strong);
}

.popup-btn {
  width: 100%;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #f8fafc;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
}

.popup-btn:hover {
  filter: brightness(1.06);
}

.insight-list {
  display: grid;
  gap: 12px;
}

.insight-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, var(--surface-muted));
}

.insight-item strong {
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.6;
  font-weight: 600;
}

.insight-item span {
  color: var(--text-soft);
  line-height: 1.9;
  font-size: 0.96rem;
  font-weight: 500;
}

.result-panel {
  margin-top: 18px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.96));
}

.output {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.output > div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  line-height: 1.9;
  font-size: 1rem;
  font-weight: 600;
}

.output > div strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.6;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

thead {
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  text-align: center;
  white-space: nowrap;
  font-size: 0.98rem;
  line-height: 1.7;
  font-weight: 500;
}

th {
  color: var(--text);
  font-weight: 600;
}

tbody tr {
  transition: background-color 0.2s ease;
}

tbody tr:hover {
  background: #f8fbff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 20px;
  background: rgba(3, 7, 18, 0.6);
  backdrop-filter: blur(12px);
  justify-content: center;
  align-items: center;
}

.popup-content {
  position: relative;
  width: min(100%, 560px);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 28px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: var(--shadow-lg);
}

.popup-kicker {
  color: var(--primary);
}

.close-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
  background: #eef2ff;
  color: #1e293b;
  box-shadow: none;
}

.close-btn:hover {
  background: #dbeafe;
}

@media (min-width: 768px) {
  .hero {
    padding-top: 28px;
  }

  .calculator-card {
    padding: 24px;
  }

  .card-heading {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  .popup-btn {
    width: auto;
    min-width: 180px;
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-full {
    grid-column: 1 / -1;
  }

  .button-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .output {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .output table {
    grid-column: 1 / -1;
  }
}

@media (min-width: 992px) {
  .content-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
    align-items: start;
  }
}

@media (max-width: 767px) {
  .calculator-card {
    display: flex;
    flex-direction: column;
  }

  .content-grid {
    display: contents;
  }

  .form-panel {
    order: 1;
  }

  .result-panel {
    order: 2;
  }

  .insight-panel {
    order: 3;
    margin-top: 18px;
  }

  .hero-shell,
  .page-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .calculator-card,
  .form-panel,
  .insight-panel,
  .result-panel,
  .popup-content {
    border-radius: 24px;
  }

  .calculator-card,
  .form-panel,
  .insight-panel,
  .result-panel {
    padding: 16px;
  }

  .popup-content {
    padding: 22px 18px 18px;
  }

  .output {
    overflow-x: auto;
  }

  table {
    min-width: 560px;
  }
}
