/* ==========================================================================
   BEP Otomasyonu - Modern UI & %100 Resmi MEB Çıktı Tasarımı
   Header ve Footer içermeyen, Saf Çalışma Alanı Odaklı Mimari
   ========================================================================== */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-dark: #3730a3;
  --secondary: #0ea5e9;
  --accent: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 72px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
}

/* Ana Uygulama Düzeni */
#app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Kenar Navigasyonu (Sidebar) - Masaüstü */
.app-sidebar {
  width: var(--sidebar-w);
  background: var(--card-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  transition: var(--transition);
  z-index: 40;
  flex-shrink: 0;
}

.app-sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.5rem 1.25rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.app-sidebar.collapsed .brand-text {
  display: none;
}

/* Navigasyon Butonları */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-top: 1.25rem;
  flex-grow: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: var(--transition);
}

.nav-item:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-item.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.nav-item i, .nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.app-sidebar.collapsed .nav-item span {
  display: none;
}

/* Alt Sidebar Aksiyonları */
.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-toggle-btn:hover {
  color: var(--text-main);
  background: var(--border-color);
}

/* Ana İçerik Alanı (Header/Footer Yok) */
.app-main {
  flex-grow: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  background: var(--bg-main);
  position: relative;
  scroll-behavior: smooth;
}

/* Modül Sekmeleri / Çalışma Alanı */
.module-view {
  display: none;
  animation: fadeIn 0.25s ease;
  max-width: 1400px;
  margin: 0 auto 3rem auto;
}

.module-view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modül Üst Şeridi (Header değil, çalışma alanı başlığı) */
.view-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.view-title-group h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.view-title-group p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

/* Kartlar ve Paneller */
.app-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  transition: var(--transition);
}

.app-card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Form Elemanları */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-inline-group {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.form-control, .form-select, .form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 0.875rem;
  transition: var(--transition);
  outline: none;
}

.form-control:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.is-invalid {
  border-color: var(--danger) !important;
  background-color: #fff5f5 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
  animation: shakeInput 0.35s ease-in-out;
}

@keyframes shakeInput {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.form-textarea {
  resize: vertical;
  min-height: 75px;
}

/* Butonlar */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
  background: var(--bg-main);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--border-color);
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover {
  filter: brightness(0.92);
}

.btn-sm {
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  border-radius: 6px;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  white-space: nowrap;
}

/* Eğitsel Performans Öğesi Başlık ve Buton Çubuğu */
.perf-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  width: 100%;
}

.perf-item-label {
  margin-bottom: 0;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 180px;
}

.perf-btn-group {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* Rozetler ve Etiketler */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.badge-secondary {
  background: var(--bg-main);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* İstatistik Kartları */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-box {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.125rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-info h3 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Hedef & Kazanım Kartları */
.objective-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.125rem;
  margin-bottom: 0.875rem;
  transition: var(--transition);
  position: relative;
}

.objective-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.objective-card.selected {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.03);
}

.objective-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.objective-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* Hızlı Branş Seçim Butonları (Chips) */
.subject-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.78125rem;
  font-weight: 600;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.subject-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

.subject-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

/* Seçmeli Ders Butonları (Özel Mor/Açık Vurgulu Stil) */
.subject-chip-elective {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.78125rem;
  font-weight: 600;
  border-radius: 9999px;
  border: 1px dashed var(--accent);
  background: #ffffff;
  color: #6d28d9;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.subject-chip-elective:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.subject-chip-elective.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
}

/* Modallar */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-backdrop.active {
  display: flex;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 750px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-main);
}

/* Bildirim Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideToast 0.3s ease;
}

@keyframes slideToast {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Mobil Alt Gezinme Çubuğu (Bottom Dock) */
.mobile-bottom-dock {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  padding: 0.5rem;
  z-index: 50;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
  justify-content: space-around;
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.dock-item.active {
  color: var(--primary);
}

/* UI Tabloları */
.meb-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 1rem;
}

.meb-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8125rem;
}

.meb-table th {
  background: var(--bg-main);
  padding: 0.75rem 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
}

.meb-table td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  color: var(--text-main);
}

.meb-table tr:last-child td { border-bottom: none; }
.meb-table tr td:last-child, .meb-table tr th:last-child { border-right: none; }

/* ==========================================================================
   RESMİ MEB BELGE & BASKI ŞABLONU (%100 MEB FORMATI)
   ========================================================================== */

.meb-official-document {
  font-family: "Times New Roman", Times, Georgia, serif !important;
  color: #000000 !important;
  background: #ffffff !important;
  line-height: 1.35;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* T.C. Resmi Başlık */
.meb-header-container {
  text-align: center;
  margin-bottom: 18px;
  border-bottom: 2px solid #000;
  padding-bottom: 10px;
}

.meb-coat-text {
  font-size: 15pt;
  font-weight: bold;
  letter-spacing: 2px;
}

.meb-ministry-text {
  font-size: 13pt;
  font-weight: bold;
  letter-spacing: 1px;
}

.meb-school-text {
  font-size: 12pt;
  font-weight: bold;
  margin-top: 2px;
}

.meb-unit-text {
  font-size: 10pt;
  color: #333;
  margin-top: 1px;
}

.meb-doc-title {
  font-size: 13pt;
  font-weight: bold;
  margin-top: 8px;
  text-decoration: underline;
  letter-spacing: 0.5px;
}

.meb-doc-code {
  font-size: 8.5pt;
  color: #555;
  margin-top: 3px;
  font-style: italic;
}

/* MEB Bölüm Başlığı */
.meb-section-header {
  font-size: 9.5pt;
  font-weight: bold;
  text-transform: uppercase;
  background: #e6e6e6;
  border: 1px solid #000;
  border-bottom: none;
  padding: 4px 8px;
  margin-top: 14px;
}

/* Resmi MEB Tabloları */
.meb-official-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.meb-official-table th, .meb-official-table td {
  border: 1px solid #000 !important;
  padding: 5px 6px;
  font-size: 8.5pt;
  vertical-align: middle;
}

.meb-official-table th {
  background: #f2f2f2 !important;
  font-weight: bold;
  text-align: center;
}

.meb-official-table .cell-label {
  font-weight: bold;
  background: #fbfbfb;
}

/* Performans Kutusu */
.meb-performance-box {
  border: 1px solid #000;
  padding: 8px 10px;
  font-size: 8.5pt;
  background: #ffffff;
  margin-bottom: 12px;
}

/* BÖP Resmi Kartı */
.bop-card-official {
  border: 1px solid #000;
  padding: 10px;
  margin-bottom: 14px;
  page-break-inside: avoid;
  background: #fff;
}

.bop-card-header {
  font-size: 9.5pt;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #000;
  padding-bottom: 4px;
  margin-bottom: 6px;
}

/* Yasal Dayanak Notu */
.meb-legal-note {
  font-size: 8pt;
  font-style: italic;
  border: 1px solid #000;
  border-top: none;
  padding: 6px 8px;
  margin-bottom: 12px;
  background: #fafafa;
}

/* Resmi İmza Grid */
.official-signature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
  page-break-inside: avoid;
}

.official-signature-box {
  border: 1px solid #000;
  padding: 8px 6px;
  text-align: center;
  min-height: 85px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sig-role {
  font-weight: bold;
  font-size: 8.5pt;
}

.sig-name {
  font-size: 8.5pt;
  margin-top: 4px;
}

.sig-title {
  font-size: 7.5pt;
  color: #444;
}

.sig-line {
  margin-top: 15px;
  border-top: 1px dashed #666;
  padding-top: 2px;
}

/* Belge Seçici Sekmeler (Mobilde Yatay Kaydırılabilir) */
.doc-selector-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

@media (max-width: 768px) {
  .doc-selector-tabs {
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }
  .doc-selector-tabs .btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* BEP Dosyası Resmi Kapak Sayfası */
.meb-cover-page {
  max-width: 800px !important;
  margin: 0 auto;
  padding: 10px;
}

.meb-cover-outer-border {
  border: 4px double #1a365d;
  padding: 8px;
  background: #ffffff;
  min-height: 960px;
  display: flex;
  flex-direction: column;
}

.meb-cover-inner-border {
  border: 1px solid #1a365d;
  padding: 25px 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ==========================================================================
   YAZDIRMA / PDF SAYFA ÇIKTI KURALLARI (@media print)
   ========================================================================== */
@media print {
  @page {
    size: A4 landscape;
    margin: 0.8cm 0.6cm;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 9pt !important;
  }

  .app-sidebar, .sidebar-footer, .sidebar-toggle-btn,
  .mobile-bottom-dock, .toast-container, .view-actions,
  .no-print, button:not(.print-keep), select, input:not(.meb-official-document input) {
    display: none !important;
  }

  #app-container {
    display: block !important;
    height: auto !important;
    width: 100% !important;
  }

  .app-main {
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  .module-view {
    display: none !important;
  }

  #view-export, .module-view.active {
    display: block !important;
  }

  .app-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .meb-official-document {
    max-width: 100% !important;
    width: 100% !important;
    page-break-after: always;
  }

  tr, .official-signature-box, .bop-card-official {
    page-break-inside: avoid !important;
  }
}

/* Mobil Hızlı Öğrenci Seçici (Masaüstünde Gizli, Mobilde Görünür) */
.mobile-student-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.875rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

/* Sayfa Altı Adım İlerleme Çubuğu (Desktop & Mobil) */
.view-bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.view-bottom-nav .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  min-height: 44px;
}

/* ==========================================================================
   %100 KUSURSUZ MOBİL VE TABLET UYUMLULUK KURALLARI
   ========================================================================== */

@media (max-width: 1024px) {
  /* Masaüstü Sidebar Tamamen Gizle ve Sıfırla */
  .app-sidebar {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    position: absolute !important;
    left: -9999px !important;
  }

  /* Mobil Hızlı Öğrenci Çubuğu Aktif */
  .mobile-student-bar {
    display: flex;
    width: 100%;
    box-sizing: border-box;
  }

  /* Ana İçerik Alanı Boşlukları (Taşma Önleyici) */
  .app-main {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 0.75rem 0.75rem calc(6.5rem + env(safe-area-inset-bottom, 0px)) 0.75rem !important;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
  }

  .module-view, .app-card, .form-group {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Performans Başlığı ve Butonları (Mobilde 3 Eşit Sütun) */
  .perf-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    width: 100%;
  }

  .perf-item-label {
    width: 100%;
    font-size: 0.875rem;
  }

  .perf-btn-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
  }

  .perf-btn-group .btn {
    width: 100% !important;
    text-align: center;
    justify-content: center;
    padding: 0.35rem 0.15rem !important;
    font-size: 0.75rem !important;
  }

  /* Mobil Alt Gezinme Çubuğu (Glassmorphism Bottom Dock) */
  .mobile-bottom-dock {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    padding: 0.35rem 0.25rem calc(0.4rem + env(safe-area-inset-bottom, 0px)) 0.25rem;
    z-index: 999;
    justify-content: space-around;
  }

  .dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.35rem 0.25rem;
    min-height: 48px;
    flex: 1;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    touch-action: manipulation;
  }

  .dock-item svg, .dock-item i {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
  }

  .dock-item.active {
    color: var(--primary);
  }

  .dock-item.active svg, .dock-item.active i {
    transform: translateY(-2px) scale(1.1);
  }

  /* Başlık ve Aksiyonlar */
  .view-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 0.875rem;
    margin-bottom: 1.125rem;
    padding-bottom: 0.875rem;
  }

  .view-title-group h2 {
    font-size: 1.2rem;
  }

  .view-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .view-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
  }

  /* Alt Adım İlerleme Çubuğu (Mobilde Büyük Dokunmatik Butonlar) */
  .view-bottom-nav {
    flex-direction: column-reverse;
    gap: 0.75rem;
    margin-top: 1.75rem;
    margin-bottom: 2.5rem;
    padding-top: 1rem;
  }

  .view-bottom-nav .btn {
    width: 100% !important;
    padding: 0.875rem 1rem !important;
    font-size: 1rem !important;
    font-weight: 700;
    justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
  }

  /* Form Alanları (iOS Auto-Zoom Engelleme: Font en az 16px) */
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .form-control, .form-select, .form-textarea {
    font-size: 16px !important;
    padding: 0.6875rem 0.875rem;
    min-height: 44px;
    border-radius: var(--radius-sm);
  }

  /* Kartlar */
  .app-card {
    padding: 1.125rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.125rem;
  }

  /* Hedef & Kazanım Kartları */
  .objective-card {
    padding: 1rem;
  }

  .objective-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .objective-top > div:last-child {
    display: flex;
    width: 100%;
    gap: 0.5rem;
  }

  .objective-top > div:last-child .btn {
    flex: 1;
    justify-content: center;
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
  }

  .objective-meta {
    gap: 0.35rem;
  }

  /* Modallar (Mobil Bottom-Sheet Esintisi) */
  .modal-dialog {
    width: calc(100vw - 24px) !important;
    max-width: 100% !important;
    max-height: 88vh !important;
    margin: auto;
    border-radius: var(--radius-lg);
  }

  .modal-header {
    padding: 1rem 1.125rem;
  }

  .modal-body {
    padding: 1.125rem;
  }

  .modal-footer {
    padding: 0.875rem 1.125rem;
    flex-direction: column;
    gap: 0.5rem;
  }

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

  /* Bildirim Toast */
  .toast-container {
    bottom: calc(65px + env(safe-area-inset-bottom, 0px));
    left: 1rem;
    right: 1rem;
    align-items: center;
  }

  .toast {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* İstatistik Grid */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* Tablolar İçin Yatay Kaydırma */
  .meb-table-wrapper {
    -webkit-overflow-scrolling: touch;
  }

  /* Çıktı ve Belge Önizleme Mobil Optimizasyonu */
  #view-export .app-card {
    padding: 1rem 0.75rem !important;
  }

  #print-preview-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
  }

  #print-preview-container .meb-official-document {
    min-width: 650px;
  }

  .official-signature-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .view-actions .btn {
    flex: 1 1 calc(50% - 0.5rem);
    justify-content: center;
  }
}

/* Küçük Ekran Telefonlar (iPhone SE, Galaxy A serisi vb. < 480px) */
@media (max-width: 480px) {
  .app-main {
    padding: 0.625rem 0.625rem calc(5.5rem + env(safe-area-inset-bottom, 0px)) 0.625rem !important;
  }

  .official-signature-grid {
    grid-template-columns: 1fr !important;
  }

  .view-actions .btn {
    flex: 1 1 100%;
    width: 100%;
  }

  .brand-text h1 {
    font-size: 0.95rem;
  }

  .badge {
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
  }

  .dock-item span {
    font-size: 0.625rem;
  }
}

