:root {
  /* Brand blue converted from CMYK C:100 M:50 Y:0 K:50 ≈ #004080 */
  --brand-blue: #004080;
  --brand-blue-dark: #003366;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-400.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-600.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-700.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

body {
  margin: 0;
  font-family: 'Vazirmatn', 'Tahoma', sans-serif;
  direction: rtl;
  background: #f4f6fb;
  color: #1d3557;
}

a {
  color: #1d3557;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--brand-blue);
  color: #fff;
}

.app-header a {
  margin-right: 1rem;
  color: #fff;
  text-decoration: none;
}

.app-main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem 4rem;
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 12px 30px rgba(12, 69, 119, 0.08);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-weight: 600;
}

.form-grid {
  display: grid;
  gap: 3rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

.form-grid label span {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
  color: #4a6075;
}

input,
select,
button {
  font-family: inherit;
}

input,
select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #ced4da;
  background: #f8fafc;
  transition: border-color 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: #0c7fad;
  background: #fff;
}

button {
  cursor: pointer;
  background: var(--brand-blue);
  color: #fff;
  padding: 0.75rem 1.8rem;
  border-radius: 999px;
  border: none;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* Reusable button class for anchors and other elements */
.button {
  cursor: pointer;
  background: var(--brand-blue);
  color: #fff;
  padding: 0.75rem 1.8rem;
  border-radius: 999px;
  border: none;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 64, 128, 0.25);
  background: var(--brand-blue-dark);
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 64, 128, 0.25);
  background: var(--brand-blue-dark);
}

.button.is-loading {
  position: relative;
  pointer-events: none;
}

.button.is-loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.1rem;
  height: 1.1rem;
  margin: -0.55rem 0 0 -0.55rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #e7edf5;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.9rem;
}

.data-table th {
  background: linear-gradient(90deg, rgba(8, 76, 131, 0.1), rgba(12, 127, 173, 0.05));
  font-weight: 600;
  color: #0b4d7c;
}

.table-wrapper {
  overflow-x: auto;
}

.hint {
  margin-top: 0.8rem;
  color: #4a6075;
  font-size: 0.85rem;
}

.preview-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
}

.preview-form label span {
  display: block;
  margin-bottom: 0.4rem;
}

.sheet-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.sheet-actions .button {
  text-decoration: none;
  display: inline-block;
  background: #fff;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  border: 1px solid var(--brand-blue);
  color: var(--brand-blue);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sheet-actions .button:hover {
  background: var(--brand-blue);
  color: #fff;
  border-color: var(--brand-blue);
}

.sheet-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.sheet-canvas {
  width: 1240px;
  height: 1754px;
  background: #fff;
  border-radius: 42px;
  box-shadow: 0 30px 60px rgba(3, 45, 94, 0.18);
  overflow: hidden;
  position: relative;
}

.sheet-background {
  position: absolute;
  inset: 0;
  background-image: url('material/background-small.png');
  background-size: cover; /* fill page */
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.5; /* subtle so content is readable */
  z-index: 0;
  pointer-events: none;
}


.sheet-bottom-pattern {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 360px;
  background-image: url('material/footer-small.png');
  background-size: cover;
  background-position: bottom;
  background-repeat: no-repeat;
  opacity: 0.6;
  pointer-events: none;
  z-index: 1;
}

.sheet-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sheet-header {
  position: relative;
  padding: 0px 48px 0px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 80px 120px;
  gap: 14px;
  align-items: center;
}

.sheet-header .full-row {
  grid-column: 1 / -1;
}
.header-equal {
  display: grid;
  grid-template-rows: repeat(2, 1fr);
  row-gap: 10px;
  height: 160px;
}
.header-equal > * {
  min-height: 0;
}

.ribbon {
  position: relative;
  background: linear-gradient(180deg, #d2002a, #8d001b);
  border-radius: 16px;
  color: #fff;
  padding: 0.7rem 0.65rem;
  text-align: center;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
  font-size: 0.88rem;
}

.header-info-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.info-card {
  background: linear-gradient(180deg, #edf4fbc5, #dfeaf8bd);
  border-radius: 16px;
  padding: 0.45rem 0.7rem;
  /* box-shadow: inset 0 2px 6px rgba(255,255,255,0.8), 0 5px 12px rgba(10,89,140,0.12); */
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 54px;
  color: #0d4c80;
}

.info-card.highlight {
  background: linear-gradient(180deg, #00a99ead, #009089ad);
  color: #fff;
}

.info-card .card-title {
  font-weight: 700;
  font-size: 1rem;
}

.info-card .card-subtitle {
  font-size: 0.82rem;
  opacity: 0.9;
}

.nights-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.05rem;
  background: linear-gradient(180deg, rgba(12, 127, 173, 0.12), rgba(12, 127, 173, 0.08));
  border-radius: 16px;
  padding: 0.45rem 0.3rem;
  text-align: center;
  min-height: 54px;
}

.nights-counter span {
  display: block;
  color: #16527a;
  font-size: 0.74rem;
}

.nights-counter strong {
  font-size: 1.65rem;
  color: #0a72a0;
  font-weight: 700;
  line-height: 1;
}

.sheet-title {
  text-align: center;
  font-size: 4rem;
  font-weight: 800;
  color: #0a3e71;
  margin: 0 0 0.15rem;
}

.sheet-title small {
  display: block;
  font-size: 0.9rem;
  color: #3b5e85;
}

.category-badge {
  background: #f59e0b; 
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  color: #5b3d00;
  font-weight: 600;
  font-size: 1rem; 
  letter-spacing: normal; 
  font-family: 'Vazirmatn', 'Tahoma', sans-serif;
  direction: rtl;
}

.category-badge-group {
  display: flex;
  justify-content: center;
  gap: 0rem;
  margin-top: 0px;
  flex-wrap: wrap;
}

.sheet-body {
  flex: 1;
  padding: 0 60px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* Fixed-height container for rates table so footer stays in frame */
.rates-area {
  /* Fix the table area height so it never pushes footer */
  flex: 0 0 980px;    /* fixed block in the flow */
  height: 980px;
  min-height: 980px;
  overflow: hidden;   /* clip inside this area */
  display: flex;
}

.rates-area .rates-table {
  width: 100%;
  height: 100%;
  table-layout: fixed;
}

.rates-area {
  flex: 1;
  min-height: 0; /* allow flex child to shrink */
  overflow: hidden; /* clip overflow to keep footer visible */
  display: flex;
}

.rates-area .rates-table {
  width: 100%;
  height: 100%;
  table-layout: fixed;
}

.legend-and-notice-row {
  display: flex;
  align-items: center;
  position: relative;
  margin-bottom: 0rem;
}

.category-badge-group {
  margin-left: auto;
  margin-right: auto;
  order: 2;
}

.suggestion-legend {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 0;
  order: 1;
}

.suggestion-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: #0b4d7c;
  font-size: 0.9rem;
}

.suggestion-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: none;
  min-width: 26px;
}

.suggestion-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.suggestion-icon .icon-char {
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
  display: inline-flex;
}



.suggestion-icon.not-recommended .icon-char {
  font-size: 0.78rem;
}

.rates-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(12, 127, 173, 0.12);
  background: rgba(255, 255, 255, 0.92);
  direction: ltr;
  table-layout: fixed;
}

.rates-table thead {
  background: var(--brand-blue);
  color: #fff;
}

.rates-table th {
  padding: 0.5rem 0.4rem;
  font-weight: 700;
  font-size: 0.92rem;
  /* Arabic/Farsi glyphs break when letter-spacing is applied; keep natural spacing */
  letter-spacing: normal;
  text-align: center;
}

.rates-table td {
  padding: 0.38rem 0.35rem;
  text-align: center;
  color: #214566;
  font-weight: 600;
  border-bottom: 1px solid rgba(8, 76, 131, 0.08);
  background: rgb(216, 231, 236);
  vertical-align: middle;
  line-height: 1.15;
}

/* Force white background only for numeric price cells */
.rates-table td.price-cell {
  background: #f0f0f094 !important;
}

/* .rates-table tbody tr:nth-child(even) td {
  background: rgba(238, 248, 255, 0.85);
} */

/* .rates-table .hotel-row.is-recommended td {
  background: rgba(69, 182, 73, 0.16);
}

.rates-table .hotel-row.is-optional td {
  background: rgba(69, 182, 73, 0.16);
} */

.rates-table .hotel-row.is-recommended td:first-child,
.rates-table .hotel-row.is-optional td:first-child {
  /* Exact 5px left stripe without affecting layout */
  box-shadow: none;
  background-image: linear-gradient(90deg, rgba(69, 182, 73, 0.55) 0, rgba(69, 182, 73, 0.55) 5px, rgba(0,0,0,0) 5px);
  background-repeat: no-repeat;
}

.rates-table .col-hotel {
  width: 15%;
  font-weight: 700;
  padding: 0.35rem 1rem;
  text-align: left;
  letter-spacing: normal; 
}
.rates-table th.col-hotel {
  color: #fffffffd;
}
.rates-table td.col-hotel {
  color: #0f406c;
}

.rates-table th.col-status,
.rates-table .col-status {
  width: 7%;
  text-align: center;
  padding: 0.35rem 0.2rem;
  letter-spacing: normal; 
}

.rates-table .col-status .suggestion-icon {
  margin: 0.0rem auto;
  /* allow JS to set exact size per row */
  width: auto;
  height: auto;
  min-width: 0;
  box-shadow: none;
  padding: 0;
}

.rates-table .col-status .suggestion-icon img {
  width: 100%;
  height: 100%;
}

.hotel-label {
  display: block;
  text-align: left;
  direction: rtl;
  font-size: 0.9rem;
  line-height: 1.15;
}

.rates-table tbody td:not(.col-hotel) {
  direction: rtl;
}

.rates-table .category-row td {
  background: linear-gradient(90deg, rgba(12, 127, 173, 0.459), rgba(13, 89, 119, 0.479)) !important;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.4rem 0.9rem;
  color: #0a3f68;
}

.category-label {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.6rem;
}

.category-label .category-name {
  justify-self: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  text-align: left;
}

.category-extra {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(12, 127, 173, 0.12);
  color: #0a3f68;
  font-size: 0.75rem;
}

.category-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  color: #f59e0b;
  letter-spacing: 0;
  font-size: 1rem;
}

.category-stars-count {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0a3f68;
}

.category-stars-icons {
  display: inline-flex;
  gap: 0.15rem;
}

.category-stars-icons .star-icon {
  position: relative;
  display: inline-flex;
  width: 0.95rem;
  height: 0.95rem;
  align-items: center;
  justify-content: center;
  color: #f6b10a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  font-size: 0.95rem;
  line-height: 1;
}

.sheet-footer {
  padding: 28px 70px 40px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: -10px;
}

.footer-logo {
  flex-shrink: 0;
}

.footer-logo img {
  display: block;
}

.footer-box {
  background: linear-gradient(180deg, rgba(240, 247, 251, 0.95), #adc5c491);
  border-radius: 28px;
  padding: 1.2rem 1.6rem;
  color: hsl(182, 27%, 19%);
  font-size: 0.95rem;
  line-height: 1.8;
  /* box-shadow: inset 0 1px 6px rgba(255, 255, 255, 0.6), 0 12px 30px rgba(12, 127, 173, 0.12); */
  direction: rtl;
  flex: 1;
}

.footer-box p {
  margin: 0.3rem 0;
  text-align: right;
}

.app-footer {
  text-align: center;
  padding: 1rem;
  color: #6b7fa0;
  font-size: 0.8rem;
}

/* Add this new rule to reduce the gap */
.sheet-header .sheet-title {
  margin-top: -30px; /* Reduced from previous value */
}

/* Validation error styles */
.error-message {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.error-message ul {
  margin: 0.5rem 0 0 1.5rem;
  padding: 0;
}

.error-message li {
  margin-bottom: 0.25rem;
}



@media print {
  body {
    background: #fff;
  }
  .app-header,
  .app-footer,
  .sheet-actions {
    display: none;
  }
  .app-main {
    margin: 0;
    padding: 0;
  }
  .sheet-canvas {
    box-shadow: none;
    border-radius: 0;
  }
  .sheet-top-pattern {
    inset: 0;
  }
  .sheet-bottom-pattern {
    display: none;
  }
  .sheet-content {
    padding-bottom: 0;
  }
  .sheet-footer {
    padding: 30px 60px 40px;
    flex-direction: column;
    gap: 15px;
  }
  .footer-logo img {
    height: 50px;
  }
  .footer-box {
    box-shadow: none;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
