/* =====================================================
   Sinaps — Mobil Tasarım v4.0
   =====================================================
   Sorun 3 çözümleri:
   - Mobil yazı boyutları düzenlendi (çok büyük olmayacak)
   - Hamburger/ok butonu menüyle birlikte hareket ediyor
   
   Sorun 4 çözümleri:
   - Mobil deneyim baştan tasarlandı
   - Bottom navigation kullanıcı dostu yapıldı
   - Kart, form, buton boyutları optimize edildi
   ===================================================== */

/* ─── Global box-sizing ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { max-width: 100vw; overflow-x: hidden; }
.modal-overlay, .auth-overlay { max-width: none; }

/* =======================================================
   MOBİL SIDEBAR + TOGGLE BUTONU  ≤768px
   Sorun 3: Ok butonu sidebar ile birlikte kayıyor
   ======================================================= */
@media (max-width: 768px) {

  /* Sidebar: varsayılan kapalı, ekran dışında */
  .sidebar {
    width: 260px !important;
    transform: translateX(-260px) !important;
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  /* Sidebar açık hali */
  .sidebar.mobile-open {
    transform: translateX(0) !important;
    box-shadow: 6px 0 32px rgba(0, 0, 0, 0.35) !important;
  }

  /* Sidebar içi yazılar her zaman görünür */
  .sidebar .logo-text,
  .sidebar .nav-section-title,
  .sidebar .nav-item span,
  .sidebar .nav-badge,
  .sidebar .user-info {
    opacity: 1 !important;
    width: auto !important;
    overflow: visible !important;
    white-space: normal !important;
    pointer-events: auto !important;
  }
  .sidebar .nav-item { justify-content: flex-start !important; padding: 11px 14px !important; }
  .sidebar .user-chip { justify-content: flex-start !important; padding: 10px 12px !important; }
  .sidebar .sidebar-logo { justify-content: flex-start !important; padding: 20px 20px 16px !important; }

  /* Toggle (ok) butonu - sidebar ile birlikte kayar */
  .sidebar-toggle-btn {
    position: fixed !important;
    top: 50% !important;
    left: 0px !important;
    transform: translateY(-50%) !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 0 8px 8px 0 !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 2px 0 12px rgba(59, 130, 246, 0.4) !important;
  }

  /* Sidebar açıkken ok sağa kayar */
  .sidebar.mobile-open ~ .sidebar-toggle-btn,
  .sidebar.mobile-open + .sidebar-toggle-btn {
    left: calc(260px - 2px) !important;
  }

  /* Ok ikonu: kapalı=sağa bak, açık=sola bak */
  .sidebar-toggle-btn svg {
    transform: rotate(180deg) !important;
    transition: transform 0.3s ease !important;
  }
  .sidebar.mobile-open ~ .sidebar-toggle-btn svg,
  .sidebar.mobile-open + .sidebar-toggle-btn svg {
    transform: rotate(0deg) !important;
  }

  /* Backdrop */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    backdrop-filter: blur(2px);
  }
  .sidebar-backdrop.active { display: block !important; }

  /* Hamburger gizle */
  .sidebar-hamburger { display: none !important; }

  /* Main content tam genişlik */
  .main-content {
    margin-left: 0 !important;
    width: 100vw !important;
    transition: none !important;
  }

} /* /sidebar mobile */


/* =======================================================
   GENEL MOBİL TASARIM  ≤768px
   ======================================================= */
@media (max-width: 768px) {

  /* Temel yazı boyutları */
  body   { font-size: 14px !important; -webkit-text-size-adjust: 100%; line-height: 1.5; }
  h1     { font-size: 1.35rem !important; line-height: 1.25; }
  h2     { font-size: 1.15rem !important; line-height: 1.3; }
  h3     { font-size: 1rem !important; line-height: 1.35; }
  h4, h5 { font-size: 0.93rem !important; }
  p      { font-size: 0.9rem !important; }

  /* Layout */
  .app-layout { width: 100vw; overflow-x: hidden; }
  #student-content, #teacher-content { width: 100%; max-width: 100%; }

  /* Page padding */
  .page-content { padding: 12px 12px 80px !important; }

  /* Top bar */
  .top-bar {
    padding: 0 12px !important;
    height: 52px !important;
    gap: 8px !important;
  }
  .top-bar-title { font-size: 0.95rem !important; font-weight: 600; }

  /* Kartlar */
  .card { padding: 14px !important; border-radius: 14px !important; }
  .card-header { padding: 14px !important; font-size: 0.95rem !important; }
  .card-body { padding: 14px !important; }

  /* Butonlar */
  .btn { font-size: 0.88rem !important; padding: 10px 16px !important; min-height: 42px !important; }
  .btn-sm { font-size: 0.8rem !important; padding: 7px 11px !important; min-height: 34px !important; }
  .btn-lg { font-size: 0.95rem !important; padding: 13px 20px !important; }

  /* Formlar */
  .form-label { font-size: 0.85rem !important; margin-bottom: 4px !important; }
  .form-control, .form-select, input, select, textarea {
    font-size: 0.9rem !important;
    padding: 10px 12px !important;
    border-radius: 10px !important;
  }
  textarea { min-height: 90px !important; }

  /* Tabs */
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    gap: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { padding: 10px 14px !important; font-size: 0.83rem !important; white-space: nowrap; min-height: 40px !important; }

  /* Grid - tek kolon */
  .grid-4, .grid-3, .grid-2 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }

  /* Toast */
  #toast-container { top: auto; bottom: 80px; right: 10px; left: 10px; }
  .toast { min-width: unset; width: 100%; padding: 12px 14px; font-size: 0.87rem; border-radius: 12px; }

  /* Chat */
  .chat-container { height: calc(100dvh - 120px); }
  .msg-bubble { font-size: 0.88rem !important; padding: 10px 13px !important; }
  .chat-input-area, .ai-input-area { padding: 9px 10px; gap: 8px; }
  .ai-bubble { font-size: 0.87rem !important; padding: 10px 13px !important; }

  /* Leaderboard */
  .leaderboard-item { padding: 12px 14px; border-radius: 12px; }
  .rank-num { font-size: 1rem; width: 28px; }
  .leaderboard-name { font-size: 0.9rem !important; }
  .leaderboard-score { font-size: 0.85rem !important; }

  /* Onboarding */
  .ob-card { width: min(94vw, 440px); padding: 24px 18px 20px; }
  .ob-btn-primary { padding: 13px 22px; font-size: 0.95rem; min-height: 48px; }
  .ob-btn-skip { padding: 9px 13px; min-height: 40px; font-size: 0.85rem; }

  /* Etüt kartları */
  .etut-card, .etut-slot {
    padding: 11px 13px !important;
    border-radius: 10px !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .etut-topic-title { font-size: 0.87rem !important; font-weight: 700 !important; line-height: 1.3 !important; }
  .etut-subject-sub, .etut-slot .etut-subject { font-size: 0.78rem !important; }
  .etut-slot .etut-meta { font-size: 0.74rem !important; }

  /* Boş durum */
  .empty-state { padding: 36px 18px !important; }
  .empty-state svg, .empty-state i[data-lucide] { width: 36px !important; height: 36px !important; }
  .empty-state h3 { font-size: 1rem !important; }
  .empty-state p { font-size: 0.85rem !important; }

  /* Bildirim */
  .notif-dropdown {
    left: 8px !important;
    right: 8px !important;
    max-width: calc(100vw - 16px) !important;
    width: auto !important;
  }
  .notif-item { padding: 11px 13px !important; }
  .notif-item-title { font-size: 0.87rem !important; }
  .notif-item-text { font-size: 0.79rem !important; }

  /* Program */
  .schedule-container { display: none !important; }
  .schedule-mobile-view, .schedule-card-list { display: flex !important; flex-direction: column; gap: 10px; }

  /* Badge */
  .badge { font-size: 0.75rem !important; padding: 3px 8px !important; }

  /* Modal - alt taraftan açılır */
  .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
  .modal {
    border-radius: 20px 20px 0 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 92dvh !important;
    overflow-y: auto !important;
    padding: 20px 16px 24px !important;
  }
  .modal-title { font-size: 1.05rem !important; }

  /* Tablo */
  .data-table { font-size: 0.82rem !important; }
  .data-table th, .data-table td { padding: 9px 10px !important; }

  /* Bottom Nav */
  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--bg-2, #1a1a2e);
    border-top: 1px solid var(--border, rgba(255,255,255,0.08));
    z-index: 150;
    padding: 0;
    gap: 0;
    align-items: stretch;
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    color: var(--text-3, rgba(255,255,255,0.45));
    font-size: 0.65rem;
    padding: 4px 2px 6px;
    transition: color 0.15s, background 0.15s;
    border-radius: 0;
    min-height: 100%;
  }
  .bottom-nav-item.active {
    color: var(--accent, #3b5bf6);
    background: rgba(59, 91, 246, 0.08);
  }
  .bottom-nav-item i[data-lucide] { width: 20px !important; height: 20px !important; }
  .bottom-nav-label { font-size: 0.62rem; line-height: 1; white-space: nowrap; }

} /* /<=768px */


/* =======================================================
   ÖĞRETMEN PANELİ  ≤768px
   ======================================================= */
@media (max-width: 768px) {

  #teacher-content .grid-2, #teacher-content .grid-3 { grid-template-columns: 1fr; gap: 12px; }
  #teacher-content .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }

  #classroom-detail .card-header { flex-wrap: wrap; gap: 10px; }
  #classroom-detail .card-header > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
  #classroom-detail .card-header .btn-sm { font-size: 0.8rem !important; padding: 8px 10px !important; min-height: 38px !important; }

  .data-table .btn-sm { padding: 7px 9px; min-height: 34px; min-width: 34px; }
  .data-table td .flex { flex-wrap: wrap; gap: 6px; }

  #teacher-curriculum-content .topic-name { font-size: 0.9rem; font-weight: 600; }
  #teacher-curriculum-content .topic-sub { font-size: 0.77rem; }
  #teacher-curriculum-content .topic-row { padding: 11px; gap: 9px; }
  #teacher-curriculum-content .curriculum-scroll { max-height: 60dvh; -webkit-overflow-scrolling: touch; }

  #student-schedule-modal .tabs { gap: 4px; overflow-x: auto; flex-wrap: nowrap; }
  #student-schedule-modal .tab-btn { font-size: 0.87rem !important; padding: 10px 13px !important; min-height: 42px !important; white-space: nowrap; }

  #stats-content .grid-2 { grid-template-columns: 1fr; gap: 12px; }
  #stats-content .chart-area { height: 150px; }

  #questions-list .card { padding: 13px; }
  #questions-list .question-text { font-size: 0.9rem; line-height: 1.5; }
  #questions-list img { max-height: 240px; width: 100%; object-fit: contain; }

} /* /<=768px ogretmen */


/* =======================================================
   KÜÇÜK MOBİL  ≤390px
   ======================================================= */
@media (max-width: 390px) {

  body { font-size: 13px !important; }
  h1   { font-size: 1.2rem !important; }
  h2   { font-size: 1.05rem !important; }

  .stats-grid { grid-template-columns: 1fr !important; }
  .hero-title { font-size: clamp(1.7rem, 9vw, 2.4rem); }
  .hero-sub { font-size: 0.88rem; }
  .hero-stats-bar { flex-wrap: wrap; gap: 8px; justify-content: center; }
  .hero-stat-divider { display: none; }
  .hero-stat { flex: 1; min-width: 70px; align-items: center; }
  .hero-stat-num { font-size: 1.25rem; }

  .notif-dropdown {
    left: 0 !important; right: 0 !important;
    max-width: 100vw !important;
    border-radius: 16px 16px 0 0 !important;
    bottom: 0 !important; top: auto !important;
    max-height: 80dvh !important;
    overflow-y: auto !important;
  }

  .etut-topic-title { font-size: 0.82rem !important; }
  #teacher-content .grid-4 { grid-template-columns: 1fr 1fr; gap: 8px; }

  .btn { padding: 9px 14px !important; font-size: 0.85rem !important; }
  .btn-sm { padding: 6px 9px !important; font-size: 0.78rem !important; }

  .bottom-nav-item i[data-lucide] { width: 18px !important; height: 18px !important; }
  .bottom-nav-label { font-size: 0.58rem; }

} /* /<=390px */


/* =======================================================
   TABLET  769px–1100px
   ======================================================= */
@media (min-width: 769px) and (max-width: 1100px) {
  .page-content { padding: 16px; }
  .card { padding: 16px; }
  .top-bar { padding: 0 16px; gap: 10px; }
  .top-bar-title { font-size: 1rem; }
}


/* =======================================================
   DRAG-AND-DROP & EXTRA UI
   ======================================================= */

.etut-card.draggable-active { cursor: grab; border: 1.5px dashed rgba(var(--accent-rgb), 0.5); transition: transform 0.15s, box-shadow 0.15s; }
.etut-card.draggable-active:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.2); }
.etut-card.dragging { opacity: 0.35; cursor: grabbing; transform: scale(0.97); }
.etut-day-container.drag-over { background: rgba(var(--accent-rgb), 0.05); border-radius: 10px; }

.teacher-etut-card.teacher-draggable-active { cursor: grab !important; border-style: dashed !important; transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s !important; }
.teacher-etut-card.teacher-draggable-active:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.18); }
.teacher-etut-card.teacher-dragging { opacity: 0.3 !important; cursor: grabbing !important; transform: scale(0.96); }

.stats-student-card:hover { background: var(--bg-3, var(--bg-1)) !important; }
.notif-item:hover .notif-del-btn { opacity: 1 !important; }

/* Soru-Cevap Odaları */
#rooms-container { display: flex; gap: 16px; }
#room-list-panel { width: 220px; flex-shrink: 0; }
@media (max-width: 640px) {
  #rooms-container { flex-direction: column; height: auto !important; }
  #room-list-panel { width: 100%; max-height: 280px; }
  #chat-area { min-height: 400px; }
}
/* ─── Teacher schedule drag-drop iyileştirmeleri ─────────────────── */
.teacher-etut-day-container.drag-over {
  background: rgba(99,102,241,0.08) !important;
  outline: 2px dashed rgba(99,102,241,0.4);
  border-radius: 8px;
}
.teacher-etut-card.teacher-dragging {
  opacity: 0.25 !important;
  cursor: grabbing !important;
  transform: scale(0.95) !important;
  pointer-events: none;
}
.teacher-etut-card.teacher-draggable-active {
  cursor: grab !important;
}
.teacher-etut-card.teacher-draggable-active:active {
  cursor: grabbing !important;
}
