/* ================================================================
   YÜKSEK UÇUŞ - RESPONSIVE.CSS
   Genel Responsive Tasarım
   ================================================================ */

/* ==================== MASAÜSTÜ (Varsayılan) ==================== */
/* 1200px ve üzeri tam genişlik */

/* ==================== KÜÇÜK MASAÜSTÜ ==================== */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* ==================== TABLET LANDSCAPE ==================== */
@media (max-width: 1024px) {
  /* Mobil Header */
  .mobile-header {
    display: flex;
  }

  .mobile-only-close {
    display: inline-flex !important;
  }

  /* Ana Layout */
  .main {
    margin-left: 0;
    padding: var(--space-md);
  }

  /* Sidebar drawer */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(280px, calc(100vw - 24px));
    height: 100vh;
    z-index: var(--z-sidebar);
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-sidebar);
    box-shadow: 20px 0 40px rgba(0, 0, 0, 0.5);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .sidebar-backdrop.active {
    display: block;
  }

  /* Stats */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Toolbar */
  .toolbar {
    flex-wrap: wrap;
  }
}


/* ==================== TABLET PORTRAIT ==================== */
@media (max-width: 980px) {
  /* Main - mobil header yukaridaki bosluk */
  .main {
    margin-left: 0;
    padding: var(--space-md);
    padding-top: calc(var(--header-height) + var(--space-md));
  }

  /* Field Rows */
  .field-row,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  /* Table */
  table {
    min-width: 700px;
  }
}


/* ==================== KÜÇÜK TABLET ==================== */
@media (max-width: 768px) {
  /* Genel */
  body {
    font-size: 13px;
  }

  /* Başlık */
  .page-title {
    font-size: 22px;
  }

  .page-subtitle {
    font-size: 13px;
  }

  /* Stats */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .stat-card .stat-value {
    font-size: 22px;
  }

  .stat-card .stat-label {
    font-size: 11px;
  }

  /* Butonlar */
  .btn {
    min-height: 36px;
    padding: 7px 12px;
    font-size: 12px;
  }

  .btn-sm {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 11px;
  }

  /* Tablo */
  th {
    font-size: 10px;
    padding: var(--space-sm);
  }

  td {
    font-size: 12px;
    padding: var(--space-sm);
  }

  /* Panel */
  .panel-head {
    padding: var(--space-sm) var(--space-md);
  }

  .panel-body {
    padding: var(--space-sm) var(--space-md);
  }

  /* Topbar */
  .topbar {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .topbar-right {
    width: 100%;
    justify-content: flex-start;
  }

  /* Toolbar */
  .toolbar {
    gap: var(--space-xs);
  }

  /* Tabs */
  .tabs {
    width: 100%;
  }

  .tab-btn {
    flex: 1;
    text-align: center;
  }

  /* Navigasyon */
  .nav-item {
    min-height: 34px;
    font-size: 12px;
  }

  /* Sidebar */
  .sidebar {
    width: min(260px, calc(100vw - 24px));
  }
}


/* ==================== BÜYÜK TELEFON ==================== */
@media (max-width: 620px) {
  /* Layout */
  .main {
    padding: var(--space-sm);
    padding-top: calc(var(--header-height) + var(--space-sm));
  }

  /* Başlık */
  .page-title {
    font-size: 20px;
  }

  /* Stats */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-height: auto;
    padding: var(--space-sm) var(--space-md);
  }

  .stat-card .stat-icon {
    margin-bottom: 0;
  }

  .stat-card .stat-value {
    font-size: 20px;
  }

  /* Butonlar */
  .btn {
    width: 100%;
    justify-content: center;
  }

  .btn-icon {
    width: 36px;
  }

  /* Topbar */
  .topbar {
    flex-direction: column;
  }

  .topbar .toolbar {
    margin-top: var(--space-sm);
  }

  /* Navigasyon */
  .nav-stack {
    grid-template-columns: 1fr;
  }

  /* Modaller */
  .modal {
    width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  /* Profile */
  .profile-grid {
    grid-template-columns: 1fr;
  }

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

  /* Theme Grid */
  .theme-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* ==================== KÜÇÜK TELEFON ==================== */
@media (max-width: 400px) {
  /* Başlık */
  .page-title {
    font-size: 18px;
  }

  /* Stats */
  .stat-card .stat-value {
    font-size: 18px;
  }

  /* Butonlar */
  .btn {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Tablo */
  th,
  td {
    padding: 6px;
    font-size: 11px;
  }

  /* Modal */
  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }
}


/* ==================== LANDSCAPE ORIENTATION ==================== */
@media (orientation: landscape) and (max-height: 500px) {
  .modal {
    max-height: 90vh;
  }

  .boot-splash {
    padding: var(--space-sm);
  }
}


/* ==================== YÜKSEK ÇÖZÜNÜRLÜK ==================== */
@media (min-width: 1600px) {
  .main {
    max-width: 1400px;
    margin-left: var(--sidebar-width);
    margin-right: auto;
    padding: var(--space-xl);
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .attendance-layout {
    grid-template-columns: 1fr 360px;
  }
}


/* ==================== DÜŞÜK ÇÖZÜNÜRLÜK ==================== */
@media (max-width: 1024px) {
  .attendance-layout {
    grid-template-columns: 1fr;
  }

  .attendance-sidebar {
    position: static;
    max-height: none;
  }
}


/* ==================== PRINT ==================== */
@media print {
  .sidebar,
  .mobile-header,
  .toast-container,
  .modal-overlay,
  .boot-splash {
    display: none !important;
  }

  .main {
    margin-left: 0;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }

  .panel {
    border: 1px solid #ddd;
    box-shadow: none;
  }

  .btn {
    display: none;
  }
}


/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .view {
    animation: none;
  }

  .modal {
    animation: none;
  }

  .toast {
    animation: none;
  }
}


/* ==================== DARK MODE ==================== */
/* zaten tokens.css ile yönetiliyor */


/* ==================== TOUCH DEVICE ==================== */
@media (hover: none) and (pointer: coarse) {
  .btn:hover {
    transform: none;
  }

  .nav-item:hover {
    background: transparent;
  }

  .class-item:hover {
    background: transparent;
  }

  .stat-card:hover {
    box-shadow: var(--shadow-sm);
  }
}

/* ==================== SETTINGS 2-COL GRID ==================== */
#ownerSettingsView > div[style*="grid-template-columns: 1fr 1fr"] {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
}

@media (max-width: 768px) {
  #ownerSettingsView > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}
