/* Servisim — Tablet & mobil responsive */

/* ===== Genel dokunmatik iyileştirmeler ===== */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .sidebar a.nav-item,
  .sidebar .sb-link,
  .sidebar .sb-dash,
  .sidebar .sb-group-trigger,
  .app-tile,
  .bottom-nav a,
  .nav-group-toggle,
  .site-nav-panel a {
    -webkit-tap-highlight-color: transparent;
  }
}

.container {
  width: min(1120px, calc(100% - 2rem));
}

.table-wrap {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.table-wrap::after {
  content: '';
  position: sticky;
  right: 0;
  top: 0;
  width: 24px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85));
  float: right;
  margin-left: -24px;
}

/* ===== Public site — mobil menü ===== */
.site-nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: rgba(15, 28, 36, 0.06);
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.site-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(8, 16, 22, 0.5);
  backdrop-filter: blur(4px);
}

.site-nav-overlay.show { display: block; }

.site-nav-panel {
  display: none;
}

/* ===== Tablet (641px – 1024px) ===== */
@media (min-width: 641px) and (max-width: 1024px) {
  .app-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.15rem 0.75rem;
    max-width: none;
  }

  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .landing-hero__inner {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 3rem 0 4rem;
  }

  .landing-hero__copy {
    max-width: 640px;
    margin: 0 auto;
  }

  .landing-hero__lead,
  .landing-hero__actions,
  .landing-hero__stats {
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
  }

  .landing-hero__actions { flex-wrap: wrap; }

  .landing-hero__visual {
    max-width: 520px;
    margin: 0 auto;
  }

  .landing-bento__item {
    grid-column: span 6;
  }

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

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .panel-content {
    padding: 1.25rem;
  }

  .page-header {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

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

  .admin-content,
  .embed-shell {
    padding: 1.15rem;
  }
}

/* ===== Mobil & küçük tablet (≤1024px) ===== */
@media (max-width: 1024px) {
  :root {
    --bottom-nav-h: 72px;
    --app-header-h: 56px;
  }

  /* Public nav drawer */
  .site-nav .inner {
    height: 58px;
    gap: 0.75rem;
  }

  .site-nav-toggle {
    display: grid;
    margin-left: auto;
  }

  .landing-home .site-nav-toggle {
    margin-left: 0;
  }

  .landing-home .nav-cta {
    margin-left: auto;
  }

  .site-nav .nav-links,
  .site-nav > .container > .inner > .nav-cta {
    display: none;
  }

  .site-nav-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 60;
    width: min(320px, 88vw);
    height: 100dvh;
    height: 100vh;
    padding: calc(1rem + env(safe-area-inset-top, 0px)) 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    background: #fff;
    box-shadow: -12px 0 40px rgba(15, 28, 36, 0.15);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }

  .site-nav-panel.open {
    transform: none;
  }

  .site-nav-panel .nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
  }

  .site-nav-panel .nav-links a {
    display: block;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--ink);
  }

  .site-nav-panel .nav-links a:hover,
  .site-nav-panel .nav-links a:active {
    background: var(--brand-soft);
    color: var(--brand-dark);
  }

  .site-nav-panel .nav-cta {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: auto;
  }

  .site-nav-panel .nav-cta .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .site-nav-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
  }

  .site-nav-panel-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: #f1f5f7;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--ink-muted);
  }

  /* Panel mobil kabuk — 900 yerine 1024 */
  body.app-mode.panel-mode {
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  }

  .sidebar {
    width: min(88vw, 320px);
  }

  .panel-content {
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header h1 {
    font-size: 1.3rem;
  }

  .page-header .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .page-header .actions .btn {
    flex: 1;
    min-width: calc(50% - 0.25rem);
    min-height: 46px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .card-header h3 {
    font-size: 1rem;
  }

  .search-bar {
    flex-direction: column;
  }

  .search-bar .form-control {
    max-width: none;
    width: 100%;
  }

  .pagination {
    justify-content: center;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar { display: none; }

  .tabs a {
    flex-shrink: 0;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  .app-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.85rem 0.5rem;
    padding: 0.5rem 0 1rem;
  }

  .app-tile span.label {
    font-size: 0.65rem;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .stat {
    padding: 0.9rem;
    border-radius: 16px;
  }

  .stat-ico .ico {
    --ico-size: 38px;
  }

  .stat .value {
    font-size: 1.15rem;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-control,
  select.form-control,
  textarea.form-control {
    font-size: 16px;
    min-height: 48px;
    border-radius: 14px;
  }

  textarea.form-control {
    min-height: 120px;
  }

  .btn {
    min-height: 48px;
    border-radius: 14px;
  }

  .btn-sm {
    min-height: 42px;
  }

  .alert {
    border-radius: 14px;
    font-size: 0.88rem;
  }

  /* Popup mobil */
  body.popup-open.panel-mode {
    padding-bottom: 0;
  }

  .app-taskbar {
    bottom: calc(var(--bottom-nav-h, 72px) + env(safe-area-inset-bottom, 0px));
  }

  body.popup-minimized.panel-mode {
    padding-bottom: calc(var(--bottom-nav-h) + 44px + env(safe-area-inset-bottom, 0px));
  }

  /* Landing mobil */
  .landing-hero {
    min-height: auto;
  }

  .landing-hero__inner {
    padding: 2rem 0 2.5rem;
    gap: 2rem;
  }

  .landing-hero__title {
    font-size: clamp(2.4rem, 11vw, 3.5rem);
  }

  .landing-hero__subtitle {
    font-size: 1.15rem;
  }

  .landing-hero__actions {
    flex-direction: column;
  }

  .landing-hero__actions .btn {
    width: 100%;
    min-height: 52px;
    justify-content: center;
  }

  .landing-hero__stats {
    gap: 1rem 1.25rem;
  }

  .landing-trust__inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .landing-trust__items {
    justify-content: center;
    gap: 0.75rem 1.25rem;
  }

  .landing-features,
  .landing-pricing,
  .landing-cta {
    padding: 3.5rem 0;
  }

  .landing-bento {
    grid-template-columns: 1fr;
  }

  .landing-bento__item,
  .landing-bento__item--wide,
  .landing-bento__item--hero {
    grid-column: span 1;
  }

  .landing-cta__box {
    padding: 2.5rem 1.5rem;
    border-radius: 20px;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 3rem 0;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    padding: 2.5rem 0 calc(2rem + env(safe-area-inset-bottom, 0px));
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .auth-page {
    padding: 1rem;
    padding-top: max(1rem, env(safe-area-inset-top, 0px));
    min-height: 100dvh;
  }

  .auth-card {
    border: none;
    border-radius: 22px;
    padding: 1.35rem;
    box-shadow: 0 12px 40px rgba(15, 28, 36, 0.1);
  }

  /* Admin mobil */
  .admin-side {
    width: min(88vw, 300px);
  }

  .admin-content {
    padding: 1rem;
  }

  .admin-top {
    padding: 0 1rem;
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(56px + env(safe-area-inset-top, 0px));
  }

  body.embed-mode .embed-shell {
    padding: 0.85rem;
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
  }
}

/* ===== Küçük telefon (≤480px) ===== */
@media (max-width: 480px) {
  .container {
    width: calc(100% - 1.25rem);
  }

  .app-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem 0.35rem;
  }

  .app-tile span.label {
    font-size: 0.6rem;
    max-width: 64px;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat .value {
    font-size: 1rem;
  }

  .stat-ico {
    flex-direction: column;
    gap: 0.5rem;
  }

  .stat-ico .ico {
    --ico-size: 34px;
  }

  .bottom-nav a span.tab-label {
    font-size: 0.58rem;
  }

  .fab {
    width: 54px;
    height: 54px;
    right: 0.85rem;
  }

  table.data {
    font-size: 0.78rem;
  }

  table.data th,
  table.data td {
    padding: 0.55rem 0.4rem;
  }

  .landing-hero__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .landing-hero__stat {
    padding-left: 0.75rem;
  }

  .page-header .actions .btn {
    min-width: 100%;
  }
}

/* ===== Yatay telefon ===== */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 900px) {
  .landing-hero__inner {
    padding: 1.5rem 0;
  }

  .auth-page {
    align-content: start;
    padding-top: 0.75rem;
  }

  .app-popup__dialog {
    height: 100vh !important;
  }
}

/* ===== Geniş tablet yatay — panel sidebar gizli kalır ===== */
@media (min-width: 901px) and (max-width: 1024px) {
  .app-grid {
    grid-template-columns: repeat(6, 1fr);
    max-width: 720px;
  }
}
