/* ==========================================================================
   layout.css
   Sayfa iskeleti: site-header (sticky), vertical tabs, footer, ana grid.
   tokens.css + base.css bağımlı.
   ========================================================================== */

/* ---------- Site Header (sticky) ---------- */
.site-header {
  background: var(--color-bg);
  box-shadow: var(--shadow-header);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header__top {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--header-height);
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--color-brand);
  flex-shrink: 0;
}

.logo svg {
  width: 28px;
  height: 28px;
}

.address-selector {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: var(--fs-base);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 0;
}

.address-selector__short {
  display: none;
}

.address-selector:hover {
  color: var(--color-brand);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.header-actions__item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--color-text);
  padding: 8px 4px;
  white-space: nowrap;
}

.header-actions__item:hover {
  color: var(--color-brand);
}

/* Touch-target compliance (WCAG 2.5.5 / Apple HIG 44px).
   Above tablet we have more horizontal room so we can use a
   tighter tap area. On phone we expand each item to 44×44 to
   avoid mis-taps on the cart icon. */
@media (max-width: 768px) {
  .header-actions__item {
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
    padding: 0 12px;
  }
}

.header-actions__cart {
  position: relative;
}

.header-actions__cart .cart-count {
  position: absolute;
  top: -4px;
  right: -6px;
  background: var(--color-brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ---------- Header ikinci satır: tabs + search ---------- */
.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-5) var(--space-3);
}


.search-bar {
  flex: 1;
  max-width: 420px;
  margin-left: auto;
}

.search-bar input {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  padding: 10px 14px;
  font-size: var(--fs-base);
  background: var(--color-bg-subtle);
}

.search-bar input:focus {
  outline: 2px solid var(--color-brand);
  outline-offset: -1px;
  background: #fff;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: var(--space-7) var(--space-5) var(--space-5);
  margin-top: var(--space-7);
  color: var(--color-text-secondary);
  font-size: var(--fs-sm);
}

/* Three-column layout: brand | Destek | İş Ortağımız Ol.
   Single column on narrow viewports (≤640px) so links wrap
   without horizontal scroll. Gap is asymmetric — vertical
   gap between rows, larger horizontal gap between cols. */
.site-footer__cols {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--space-6) var(--space-7);
  margin-bottom: var(--space-6);
}

@media (max-width: 640px) {
  .site-footer__cols {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
}

.site-footer__brand h4 {
  font-size: 1.25rem;
  margin: 0 0 var(--space-2);
  color: var(--color-text);
}

.site-footer h4 {
  font-size: 0.95rem;
  margin: 0 0 var(--space-3);
  color: var(--color-text);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li {
  margin-bottom: var(--space-2);
}

.site-footer li:last-child {
  margin-bottom: 0;
}

.site-footer a {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 120ms ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--color-brand);
  text-decoration: underline;
}

/* Bottom row: copyright on the left, render-time badge on the
   right. Stacks on narrow viewports. The horizontal rule above
   it gives visual separation from the column grid. */
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  opacity: 0.85;
}

/* Render-time badge in the footer. Deliberately dimmer than
   the rest of the footer text and a hair smaller — the goal
   is "operator telemetry", not "user-facing info". */
.site-footer__render-time {
  display: inline-block;
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
}

/* Public pages (anonymous-friendly shell) — used by /iletisim,
   /gizlilik, /yardim, /search. Single column, comfortable
   reading width, no authed sidebar. */
.public-page {
  padding: var(--space-6) 0 var(--space-7);
}

.public-section__inner {
  max-width: 640px;
  /* Center the column inside the wider marketplace container.
     Without this, single-column public content sits flush
     left and the right half of the page looks abandoned on
     desktop / tablet. The horizontal padding keeps text off
     the viewport edge on mobile. */
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.public-section h1 {
  /* Fluid h1 for public pages — same scale as hero title so the
     heading hierarchy feels consistent across landing → legal
     pages. */
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 var(--space-3);
  color: var(--color-text);
}

.public-section p {
  margin: 0 0 var(--space-4);
  line-height: 1.5;
}

.public-section .contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.public-section .contact-form label {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: 0.95rem;
  font-weight: 500;
}

.public-section .contact-form input,
.public-section .contact-form textarea,
.public-section .public-form input,
.public-section .public-form textarea {
  width: 100%;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.public-section .contact-form input:focus,
.public-section .contact-form textarea:focus,
.public-section .public-form input:focus,
.public-section .public-form textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand) 18%, transparent);
}

.public-section .contact-form textarea,
.public-section .public-form textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

.public-section .contact-form small,
.public-section .public-form small {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--color-text-secondary, #6b7280);
}

.public-section .contact-form button,
.public-section .public-form button {
  align-self: flex-start;
  padding: 0.75rem 1.5rem;
  min-height: 44px;
}

.public-section .contact-alt,
.public-section .public-alt {
  margin-top: var(--space-5);
  font-size: 0.9rem;
}

.flash {
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  border-radius: 8px;
  font-size: 0.95rem;
  border: 1px solid;
}

.flash--ok {
  background: #f0f9f1;
  border-color: #b7e0c0;
  color: #1f5d2c;
}

.flash--err {
  background: #fdf2f2;
  border-color: #f5c2c2;
  color: #8a1c1c;
}

/* FAQ list — uses native <details>/<summary> so no JS
   is needed for expand/collapse. We just restyle the
   marker and add a bit of breathing room between items. */
.faq-list {
  margin: var(--space-5) 0;
}

.faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) 0;
}

.faq-item:first-child {
  border-top: 1px solid var(--color-border);
}

.faq-item summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 1rem;
  list-style: none;
  padding-right: var(--space-5);
  position: relative;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  line-height: 1;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin: var(--space-3) 0 0;
  color: var(--color-text-secondary);
  line-height: 1.55;
}

/* Privacy actions (Verilerimi İndir / Hesabımı Sil). */
.privacy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

.privacy-delete-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.btn--danger {
  background: #c8281c;
  color: #fff;
  border-color: #c8281c;
}

.btn--danger:hover,
.btn--danger:focus-visible {
  background: #a51f15;
  border-color: #a51f15;
}

/* ---------- Mobile drawer (slide-in from left) ---------- */
.mobile-drawer {
  border: 0;
  padding: 0;
  width: min(85vw, 320px);
  height: 100vh;
  max-height: 100vh;
  background: var(--color-bg);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.18);
  margin: 0 auto 0 0;
}

.mobile-drawer::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}

.mobile-drawer__close {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  font-size: 24px;
  color: var(--color-text-secondary);
  border-radius: 8px;
}

.mobile-drawer__close:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text);
}

.mobile-drawer__section {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.mobile-drawer__title {
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.mobile-drawer__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-weight: 600;
  color: var(--color-text);
}

.mobile-drawer__link:hover {
  color: var(--color-brand);
}

/* Hamburger button is visible only on mobile. */
.mobile-drawer-toggle {
  display: none;
}

@media (max-width: 768px) {
  .mobile-drawer-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: inherit;
    border-radius: 8px;
  }

  .mobile-drawer-toggle:hover {
    background: var(--color-bg-subtle);
  }

  /* Header tightens on mobile; the right-side icons stop growing. */
  .site-header__top {
    flex-wrap: wrap;
    gap: 6px 8px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .address-selector {
    max-width: 110px;
    font-size: 12px;
  }

  .address-selector__full {
    display: none;
  }

  .address-selector__short {
    display: inline;
  }

  .header-actions {
    flex-shrink: 0;
    max-width: 220px;
  }

  /* Hide verbose labels next to icons. */
  .header-actions__label {
    display: none;
  }

  .header-actions__item {
    padding: 6px 8px;
    font-size: 13px;
  }

  /* The horizontal tabs (Restoran / Gel Al / Market) move into
     the slide-in drawer on mobile. */
  .site-header__nav {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }
}


/* Cart-count badge: hidden when count is zero. The Go
   template renders "0" or the actual number; the JS
   syncCart callback updates it on add/remove. */
.cart-count:empty,
.cart-count[data-count="0"],
.cart-count[data-zero="true"] {
  display: none;
}


/* ---------- Account placeholder pages ---------- */
.account-page {
  padding: var(--space-6) 0;
  min-height: 60vh;
}

.account-page h1 {
  font-size: var(--fs-xxl);
  margin-bottom: var(--space-3);
}

.account-page--empty {
  text-align: center;
  padding-top: var(--space-7);
}

/* ---------- Account layout (sidebar + content) ----------
   Shared grid shell for /h/* pages. Replaces a missing
   `.account-layout` definition that was referenced in the
   templates but never styled — that's why the sidebar used
   to render above the content instead of beside it.

   Two columns on desktop (280px sidebar + flexible main),
   stacked on tablet/mobile. The container caps the total
   width so the grid doesn't run edge-to-edge on 1440px. */
.account-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.account-layout > .account-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
}

.account-layout > #account-content {
  min-width: 0; /* let grid item shrink below its content's
                   intrinsic width so input rows wrap nicely */
}

@media (max-width: 960px) {
  .account-layout {
    grid-template-columns: 1fr;
  }
  .account-layout > .account-sidebar {
    position: static;
  }
}

/* ---------- Account sidebar ---------- */
.account-sidebar {
  background: var(--color-surface, var(--color-bg));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}

.account-sidebar__nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.account-sidebar__nav li {
  margin: 0;
}

.account-sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-button);
  color: var(--color-text);
  font-weight: 500;
  font-size: var(--fs-base);
  transition: background 120ms ease, color 120ms ease;
}

.account-sidebar__link:hover {
  background: var(--color-bg-subtle, #f7f7f8);
  color: var(--color-brand);
}

.account-sidebar__link.is-active {
  background: var(--color-brand-light, #ffe1ea);
  color: var(--color-brand);
  font-weight: 600;
}

.account-sidebar__link .icon {
  /* Sized container for the inline SVG glyph so the layout
     is identical whether the link has a 20×20 SVG (default)
     or nothing. */
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  color: var(--color-text-secondary, #6b7280);
}

.account-sidebar__link.is-active .icon {
  color: var(--color-brand);
}

/* ---------- Account content card ----------
   The right-hand side of the grid. Wraps whatever the
   fragment handler returns (profile form, orders list,
   address form, etc.) in a card so each page reads as a
   contained section rather than a floating block. */
#account-content {
  background: var(--color-surface, var(--color-bg));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
}

#account-content h1 {
  margin-top: 0;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 700;
  letter-spacing: -0.01em;
}

@media (max-width: 640px) {
  .account-sidebar {
    padding: var(--space-3);
  }
  .account-sidebar__link {
    padding: 12px 10px;
    font-size: 15px;
  }
  #account-content {
    padding: var(--space-4);
  }
}

/* ---------- Account empty states ----------
   Used by /h/adresler, /h/siparisler, /h/favoriler, /h/kart
   when the user has no rows yet. Sits inside #account-content
   so the outer card already gives the breathing room; we just
   center the message and offer a CTA. */
.account-empty {
  padding: var(--space-6) 0 var(--space-5);
  text-align: center;
  color: var(--color-text-secondary, #6b7280);
}

.account-empty__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-3);
  border-radius: 50%;
  background: var(--color-bg-subtle, #f5f5f7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary, #6b7280);
}

.account-empty__title {
  margin: 0 0 var(--space-2);
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
}

.account-empty__hint {
  margin: 0 0 var(--space-4);
  font-size: 14px;
  color: var(--color-text-secondary, #6b7280);
}

.account-page--empty .muted {
  color: var(--color-text-secondary);
  font-size: var(--fs-md);
  margin-bottom: var(--space-5);
}
