/**
 * Layout system — RTL-friendly split pages, forms, tables
 * Main content RIGHT | Sidebar/summary LEFT (desktop)
 */

/* ── Split layout (cart, checkout, configurator, profile) ── */
.split-layout {
  display: grid;
  gap: 1.5rem;
  width: 100%;
  align-items: start;
}

.split-layout__main { min-width: 0; }

.split-layout__aside {
  min-width: 0;
}

@media (min-width: 992px) {
  .split-layout {
    grid-template-columns: 1fr minmax(320px, 400px);
    grid-template-areas: "main aside";
  }
  .split-layout__main { grid-area: main; }
  .split-layout__aside { grid-area: aside; }
}

@media (max-width: 991px) {
  .split-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "main" "aside";
  }
}

/* Reverse: sidebar first in DOM but show main first on mobile */
.split-layout--aside-first {
  grid-template-areas: "aside" "main";
}
@media (min-width: 992px) {
  .split-layout--aside-first {
    grid-template-areas: "main aside";
  }
}

/* ── Two equal / form + summary ── */
.duo-layout {
  display: grid;
  gap: 1.5rem;
  align-items: start;
  max-width: 1200px;
  margin-inline: auto;
}

@media (min-width: 992px) {
  .duo-layout {
    grid-template-columns: 1.15fr .85fr;
  }
  .duo-layout--reverse {
    grid-template-columns: .85fr 1.15fr;
  }
}

/* ── Page shell ── */
.page-body--soft { background: var(--bg-soft); }
.page-body--soft .page-body__inner { padding: 2rem 0 3.5rem; }

.page-narrow { max-width: 960px; margin-inline: auto; }
.page-medium { max-width: 1200px; margin-inline: auto; }

/* ── Cards inside layouts (override centered form-card) ── */
.split-layout .card-panel,
.duo-layout .card-panel,
.split-layout .form-card,
.duo-layout .form-card,
.split-layout .content-card,
.duo-layout .content-card {
  max-width: none;
  margin-inline: 0;
}

.card-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  box-shadow: 0 2px 12px rgba(11, 31, 74, .04);
}

.card-panel__title {
  font-size: 1.05rem;
  color: var(--navy);
  margin: 0 0 1rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--border);
}

.card-panel--sticky {
  position: sticky;
  top: 96px;
}

@media (max-width: 991px) {
  .card-panel--sticky { position: static; }
}

/* ── Summary box (order recap) ── */
.summary-box__line {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  font-size: .88rem;
  padding: .4rem 0;
  color: var(--muted);
}
.summary-box__line strong { color: var(--navy); font-weight: 700; }
.summary-box__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: .85rem 0 1rem;
  padding-top: .85rem;
  border-top: 2px solid var(--border);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
}
.summary-box__total strong { font-size: 1.25rem; }
.summary-box__note {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 1rem;
}
.summary-box__link {
  display: block;
  text-align: center;
  margin-top: .65rem;
  font-size: .88rem;
  font-weight: 600;
  color: var(--navy);
}
.summary-box .btn-block { width: 100%; }

.text-free { color: #2d6a4f !important; font-weight: 700; }

/* ── Checkout lines ── */
.checkout-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .92rem;
}
.checkout-line:last-of-type { border-bottom: 0; }
.checkout-line small { color: var(--muted); }

/* ── Search bar (services) ── */
.search-bar {
  display: flex;
  gap: .5rem;
  max-width: 480px;
  margin: 0 auto 2rem;
  flex-wrap: wrap;
}
.search-bar .form-control {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}

/* ── Profile sidebar ── */
.profile-layout {
  display: grid;
  gap: 1.5rem;
  max-width: 1000px;
  margin-inline: auto;
}
@media (min-width: 768px) {
  .profile-layout {
    grid-template-columns: 260px 1fr;
  }
}
.profile-nav a {
  display: block;
  padding: .6rem .85rem;
  border-radius: 8px;
  margin-bottom: .25rem;
  font-weight: 600;
  font-size: .92rem;
}
.profile-nav a.active,
.profile-nav a:hover {
  background: var(--bg-soft);
  color: var(--navy);
}
.profile-stat {
  text-align: center;
  padding: 1rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.profile-stat strong {
  display: block;
  font-size: 2rem;
  color: var(--navy);
  line-height: 1.1;
}
.profile-stat span { font-size: .88rem; color: var(--muted); }

/* ── Contact duo ── */
.contact-layout {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}
@media (min-width: 768px) {
  .contact-layout { grid-template-columns: 1fr 1fr; }
}

/* ── Order tracker ── */
.order-tracker {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.track-step {
  flex: 1;
  min-width: 72px;
  text-align: center;
  opacity: .4;
}
.track-step.done,
.track-step.current { opacity: 1; }
.track-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border);
  display: block;
  margin: 0 auto .45rem;
}
.track-step.done .track-dot { background: var(--yellow); }
.track-step.current .track-dot {
  background: var(--navy);
  box-shadow: 0 0 0 4px rgba(11, 31, 74, .12);
}
.track-label { font-size: .72rem; font-weight: 600; line-height: 1.3; }

/* ── Status badges ── */
.status-badge {
  padding: .22rem .6rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  background: var(--bg-soft);
  white-space: nowrap;
}
.status-done, .status-shipped { background: #e8f8ef; color: #1b6b3a; }
.status-cancelled { background: #fdecea; color: #a1281f; }
.status-in_progress, .status-in_design { background: #eaf2ff; color: #1d4f91; }
.status-paid, .status-confirmed { background: #e8f8ef; color: #1b6b3a; }
.status-pending { background: #fff8e6; color: #8a6d00; }

/* ── Responsive tables → cards on mobile ── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 767px) {
  .table-stack thead { display: none; }
  .table-stack tbody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    padding: .85rem;
    background: var(--bg-soft);
  }
  .table-stack tbody td {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    padding: .35rem 0;
    border: 0;
    text-align: left;
  }
  .table-stack tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--navy);
    flex-shrink: 0;
  }
}

/* ── Mobile sticky action bar ── */
.mobile-action-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: .75rem max(1rem, env(safe-area-inset-left));
  padding-bottom: max(.75rem, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgba(11, 31, 74, .1);
  gap: .75rem;
  align-items: center;
}
.mobile-action-bar__info { flex: 1; min-width: 0; }
.mobile-action-bar__info span {
  display: block;
  font-size: .75rem;
  color: var(--muted);
}
.mobile-action-bar__info strong {
  font-size: 1rem;
  color: var(--navy);
}
@media (max-width: 991px) {
  .mobile-action-bar { display: flex; }
  .has-mobile-bar { padding-bottom: 5.5rem !important; }
  .hide-on-mobile-bar { display: none !important; }
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  max-width: 480px;
  margin-inline: auto;
}
.empty-state__icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: .45;
  line-height: 1;
}
.empty-state p { margin-bottom: 1.25rem; }

/* ── Grid utilities (internal forms, promo rows) ── */
.grid-2 {
  display: grid;
  gap: 1rem;
}
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 992px) {
  .grid-2--3 { grid-template-columns: repeat(3, 1fr); }
}

/* ── Checkout total ── */
.checkout-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid var(--border);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
}
.checkout-total strong { font-size: 1.2rem; }

/* ── Order history ── */
.history-list { list-style: none; padding: 0; margin: 0; }
.history-list li {
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .92rem;
}
.history-list span { color: var(--muted); margin-right: .5rem; font-size: .85rem; }
.history-list p { margin: .25rem 0 0; color: var(--muted); font-size: .85rem; }

/* ── Auth pages ── */
.auth-page {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  padding: 3rem 0;
  background: var(--bg-soft);
}
.auth-page .form-card { width: 100%; max-width: 440px; }
.auth-page__title {
  text-align: center;
  color: var(--navy);
  margin-bottom: 1.25rem;
  font-size: 1.5rem;
}

/* ── Content helpers ── */
.content-list {
  list-style: disc;
  padding-right: 1.25rem;
  color: var(--muted);
  margin: 0 0 1rem;
}
.content-list li { margin-bottom: .35rem; }
.pricing-block { margin-bottom: 2rem; }
.pricing-block__title {
  color: var(--navy);
  margin-bottom: .75rem;
  font-size: 1.2rem;
}
.service-price {
  color: var(--navy);
  font-weight: 700;
  margin-bottom: .5rem;
}
.btn-block { width: 100%; }
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1rem;
}
.stack > * + * { margin-top: 1.5rem; }
.selection-list {
  margin: .35rem 0 0;
  padding-right: 1rem;
  font-size: .85rem;
  color: var(--muted);
  list-style: none;
}
.selection-list li { margin-bottom: .2rem; }

/* ── Success / payment pages ── */
.success-page {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  padding: 3rem 0;
  background: var(--bg-soft);
}
.success-page .form-card,
.payment-page .form-card {
  text-align: center;
  max-width: 560px;
}
.success-page__icon {
  font-size: 3rem;
  margin-bottom: .5rem;
  color: #2d6a4f;
  line-height: 1;
}
.success-page__title {
  color: var(--navy);
  margin-bottom: .75rem;
}
.payment-page {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  padding: 3rem 0;
  background: var(--bg-soft);
}
.payment-page .form-card { max-width: 480px; }
.form-stack {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-top: 1.5rem;
}
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.subsection-title {
  color: var(--navy);
  font-size: 1rem;
  margin-bottom: .75rem;
}
