/* ================================================================
   YÜKSEK UÇUŞ - MODALS.CSS
   Modal, Overlay, Dialog Pencereleri
   ================================================================ */

/* ==================== MODAL OVERLAY ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: var(--overlay);
  backdrop-filter: blur(6px);
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Body scroll kilidi */
body.modal-open {
  overflow: hidden;
}


/* ==================== MODAL ==================== */
.modal {
  width: min(100%, 560px);
  max-height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-xl);
  animation: fadeUp 0.2s ease both;
  overscroll-behavior: contain;
}

/* Boyutlar */
.modal-sm {
  max-width: 400px;
}

.modal-lg {
  max-width: 720px;
}

.modal-xl {
  max-width: 960px;
}

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


/* ==================== MODAL HEADER ==================== */
.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}


/* ==================== MODAL BODY ==================== */
.modal-body {
  flex: 1;
  padding: var(--space-md);
  overflow-y: auto;
}


/* ==================== MODAL FOOTER ==================== */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

/* Alternatif: Sol ve Sağ */
.modal-footer-between {
  justify-content: space-between;
}


/* ==================== MODAL İÇERİK YAPILARI ==================== */

/* Profil Grid */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}

.profile-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  padding: var(--space-sm);
}

.profile-item dt {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.profile-item dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.profile-item.wide {
  grid-column: 1 / -1;
}


/* ==================== AYARLAR MODALI ==================== */
.settings-group {
  margin-bottom: var(--space-lg);
}

.settings-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.settings-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  margin-bottom: var(--space-sm);
}

.settings-row-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.settings-row-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Tema Seçici */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}

.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-card:hover {
  border-color: var(--border-focus);
}

.theme-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.theme-card-preview {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.theme-card-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}


/* ==================== ÖĞRENCİ DETAY MODALI ==================== */
.student-detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.student-detail-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.student-detail-info {
  flex: 1;
}

.student-detail-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}

.student-detail-meta {
  font-size: 13px;
  color: var(--text-dim);
}

.student-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.student-stat-card {
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  text-align: center;
}

.student-stat-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.student-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}


/* ==================== HAFTALIK PLAN MODALI ==================== */
.plan-grid {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: var(--space-sm);
}

.plan-day {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  padding: var(--space-sm);
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  text-align: center;
}

.plan-content {
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  min-height: 60px;
}

.plan-content textarea {
  width: 100%;
  min-height: 50px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  resize: vertical;
  outline: none;
}


/* ==================== TOPLU İŞLEM MODALI ==================== */
.bulk-preview {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
}

.bulk-preview-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.bulk-preview-item:last-child {
  border-bottom: none;
}


/* ==================== ONAY MODALI ==================== */
.confirm-modal {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
}

.confirm-modal .modal-body {
  text-align: center;
  padding: var(--space-lg);
}

.confirm-modal-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-sm);
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  font-size: 24px;
}

.confirm-modal-icon.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.confirm-modal-icon.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.confirm-modal-icon.success {
  background: var(--success-soft);
  color: var(--success);
}

.confirm-modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.confirm-modal-text {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 400px;
  margin: 0 auto;
}

.confirm-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0 var(--space-lg) var(--space-lg);
}


/* ==================== DATE PICKER MODAL ==================== */
.datepicker-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: var(--space-md);
}

.datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
}

.datepicker-month {
  font-size: 14px;
  font-weight: 700;
}

.datepicker-nav {
  display: flex;
  gap: 4px;
}

.datepicker-nav button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.datepicker-nav button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.datepicker-day {
  width: 100%;
  aspect-ratio: 1;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.datepicker-day:hover {
  background: var(--accent-soft);
}

.datepicker-day.today {
  border: 1px solid var(--accent);
}

.datepicker-day.selected {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.datepicker-day.other-month {
  color: var(--text-muted);
  opacity: 0.5;
}

.datepicker-day.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}


/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .modal {
    width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  .modal-header {
    padding: var(--space-sm) var(--space-md);
  }

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

  .modal-footer {
    padding: var(--space-sm) var(--space-md);
    flex-wrap: wrap;
  }

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

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

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

  .plan-grid {
    grid-template-columns: 80px 1fr;
  }
}
