/* ============================================================
   Pertevniyal Rehber — Responsive Desktop Layer
   Mobile-first base stays intact. Desktop transforms the layout:
   - Bottom tab bar → left sidebar
   - Single column → multi-column grids
   - Top bar → proper desktop header
   ============================================================ */

/* Tablet spacing handled in base.css — keep mobile-app feel intact */

/* ── Desktop (≥ 1024px): sidebar + multi-col layout ────────── */
@media (min-width: 1024px) {

  /* ── Global body ──────────────────────────────────────── */
  body {
    padding: 0;
    background: var(--cream);
    min-height: 100vh;
  }

  /* ── App shell becomes full-width with left sidebar gap ─ */
  .app {
    max-width: none;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding-left: 260px;
    border-radius: 0;
    border: none;
    box-shadow: none;
    overflow: hidden;
  }

  /* Drawer + hamburger hidden on desktop (sidebar is always visible) */
  .hamburger,
  .drawer {
    display: none !important;
  }

  /* ── Top bar becomes proper desktop header ────────────── */
  .top-bar {
    height: 72px;
    padding: 0 var(--s-7);
    background: rgba(243, 238, 226, 0.85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .top-bar.is-navy {
    background: var(--navy);
    backdrop-filter: none;
  }

  .top-bar__title {
    font-size: 20px;
    text-align: left;
    flex: 1;
  }

  /* Hide mobile-style brand in top bar (since sidebar shows it) */
  .top-bar__brand {
    display: none;
  }

  .top-bar__btn {
    width: 44px;
    height: 44px;
  }

  /* Navy top bars stay full color — brand badge in white */
  .top-bar.is-navy .top-bar__title {
    text-align: left;
  }

  /* ── Bottom tab bar → Left Sidebar ─────────────────────── */
  .tab-bar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    width: 260px;
    height: auto;
    padding: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    background: var(--white);
    border-top: none;
    border-right: 1px solid var(--line);
    box-shadow: 1px 0 0 var(--line);
    z-index: 100;
    gap: 2px;
    overflow-y: auto;
  }

  /* Inject brand at top of sidebar */
  .tab-bar::before {
    content: '';
    display: block;
    height: 88px;
    background:
      url('../img/plyd-logo.png') no-repeat 24px center / 40px 40px,
      linear-gradient(to right, var(--cream) 0%, var(--cream) 100%);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
  }

  .tab-bar::after {
    content: 'REHBER\A Pertevniyal Lisesi';
    white-space: pre;
    position: absolute;
    top: 24px;
    left: 76px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 16px;
    color: var(--navy);
    letter-spacing: 0.04em;
    line-height: 1.5;
  }

  /* Tab items → horizontal row items inside sidebar */
  .tab-bar__item {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 14px;
    padding: 11px 16px;
    margin: 2px 12px;
    border-radius: var(--r-sm);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--body);
    text-align: left;
    min-height: 44px;
  }

  .tab-bar__item:first-of-type {
    margin-top: var(--s-4);
  }

  .tab-bar__item:hover {
    background: var(--cream);
    color: var(--navy);
  }

  .tab-bar__item svg {
    width: 20px;
    height: 20px;
  }

  .tab-bar__item.is-active {
    background: var(--navy);
    color: var(--white);
  }
  .tab-bar__item.is-active svg {
    fill: transparent;
    stroke: var(--white);
  }
  .tab-bar__item.is-active::before {
    display: none;
  }

  /* Sidebar footer — add a donate CTA block via ::after extension */
  .tab-bar > *:last-child::after {
    content: '';
    /* placeholder — sidebar footer could be added via HTML injection; skip for now */
  }

  /* ── App body — centered content container ────────────── */
  .app-body {
    padding: var(--s-6) var(--s-7) var(--s-8);
    overflow: visible;
    min-height: calc(100vh - 72px);
  }

  /* Add inner max-width wrapper semantics via direct children */
  .app-body > .px,
  .app-body > .home-greeting,
  .app-body > .hero-card,
  .app-body > .profile-hero,
  .app-body > .profile-stats,
  .app-body > .donate-hero,
  .app-body > .detail-cover,
  .app-body > .detail-body {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }

  .px {
    padding-left: 0;
    padding-right: 0;
  }

  /* Hero card takes full container width */
  .hero-card {
    margin: 0 auto;
    max-width: 1200px;
    padding: var(--s-8) var(--s-7);
    border-radius: var(--r-xl);
  }
  .hero-card h2 {
    font-size: 32px;
    max-width: 600px;
  }
  .hero-card p {
    max-width: 560px;
    font-size: 16px;
  }

  /* ── Home greeting ─────────────────────────────────────── */
  .home-greeting {
    padding: var(--s-6) 0 var(--s-5);
  }
  .home-greeting__hello { font-size: 15px; }
  .home-greeting__name { font-size: 34px; }

  /* ── Section headers ───────────────────────────────────── */
  .section-header {
    margin: var(--s-8) 0 var(--s-5);
  }
  .section-header__title {
    font-size: 24px;
  }

  /* ── Profile hero — bigger ─────────────────────────────── */
  .profile-hero {
    padding: var(--s-8) var(--s-6) var(--s-9);
    border-radius: var(--r-xl);
    margin-bottom: 0;
  }
  .profile-hero .avatar.is-xl { width: 128px; height: 128px; font-size: 40px; }
  .profile-hero__name { font-size: 32px; }

  .profile-stats {
    max-width: 720px;
    margin: calc(var(--s-7) * -1) auto var(--s-6);
    padding: var(--s-5) var(--s-6);
  }
  .profile-stat__num { font-size: 26px; }

  /* ── Carousels become grids on desktop ─────────────────── */
  .carousel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--s-4);
    overflow: visible;
    padding: 0;
    margin: 0;
    scroll-snap-type: none;
  }
  .carousel > * {
    min-width: 0;
    max-width: none;
    scroll-snap-align: unset;
  }

  .alumnus-card {
    min-width: 0;
    max-width: none;
    padding: var(--s-5);
  }
  .alumnus-card .avatar.is-lg { width: 80px; height: 80px; font-size: 26px; }

  /* ── Lists — keep single column inside a centered card ─── */
  /* Most .card with list-items stay readable on desktop */

  /* ── Event / Job / Project / Mentor lists → grid ───────── */
  .app-body .stack:has(> .event-card),
  .app-body .stack:has(> .project-card),
  .app-body .stack:has(> .job-card),
  .app-body .stack:has(> .mentor-card) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--s-5);
  }

  .app-body .stack:has(> .event-card) > * + *,
  .app-body .stack:has(> .project-card) > * + *,
  .app-body .stack:has(> .job-card) > * + *,
  .app-body .stack:has(> .mentor-card) > * + * {
    margin-top: 0;
  }

  /* Event card cover slightly taller on desktop */
  .event-card__cover { aspect-ratio: 16 / 9; }

  /* ── Donate hero — bigger ──────────────────────────────── */
  .donate-hero {
    margin: var(--s-5) auto;
    max-width: 1200px;
    padding: var(--s-8) var(--s-7);
    border-radius: var(--r-xl);
  }
  .donate-hero h2 {
    font-size: 36px;
    max-width: 640px;
  }
  .donate-hero__amount {
    font-size: 44px;
  }

  /* ── Segmented control — max width ─────────────────────── */
  .segmented {
    max-width: 480px;
  }

  /* ── Search bar — larger ───────────────────────────────── */
  .search {
    padding: 12px 20px;
  }
  .search input { font-size: 15px; }

  /* ── Forms — 2-column where appropriate ────────────────── */
  .detail-body {
    padding: var(--s-6) 0;
    max-width: 860px !important;
  }
  .detail-body h1 { font-size: 32px; }

  .detail-cover {
    border-radius: var(--r-xl);
    margin: 0 auto var(--s-6);
    max-width: 1200px;
    aspect-ratio: 21 / 9;
  }
  .detail-cover h1 {
    font-size: 36px !important;
  }

  /* ── Card defaults ─────────────────────────────────────── */
  .card {
    padding: var(--s-6);
  }

  /* ── FAB hidden on desktop — inline CTA in top bar should replace ─ */
  .fab {
    display: none;
  }

  /* ── Chip row items wrap nicely ────────────────────────── */
  .chip-row {
    flex-wrap: wrap;
  }

  /* ── Match strip — bigger font ─────────────────────────── */
  .match-strip {
    padding: var(--s-5);
  }
  .match-strip__icon { width: 48px; height: 48px; }
  .match-strip__text { font-size: var(--fs-body); }

  /* ── Profile page: 2-column where possible ─────────────── */
  /* Main profile card and settings stack vertically; keep readable single column */
  /* We'll use a grid in the .px wrapper on profile.html */

  .app-body .px > .card + .card {
    margin-top: var(--s-5);
  }

  /* Make card content wider but list items remain pleasant */
  .list-item {
    padding: var(--s-4) 0;
  }

  /* ── Amount grid — 6 columns on desktop ────────────────── */
  .amount-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  /* ── Smooth scroll behavior ────────────────────────────── */
  html { scroll-behavior: smooth; }
}

/* ── Ultra-wide (≥ 1440px) ─────────────────────────────── */
@media (min-width: 1440px) {
  .app {
    padding-left: 280px;
  }
  .tab-bar {
    width: 280px;
  }
  .tab-bar::after { left: 84px; }
  .tab-bar::before {
    background-position: 28px center;
  }
  .app-body {
    padding: var(--s-7) var(--s-8) var(--s-9);
  }
}

/* ── Reduced motion respect ────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
