/**
 * korbt.kimlik - Main Application Styles
 * Modern, responsive, clean, high-performance UI
 */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================= */
/* Top Navigation Bar                                            */
/* ============================================================= */
.app-navbar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-korbt {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.brand-dot {
  font-family: 'Outfit', sans-serif;
  color: #14b8a6; /* korbt.com teal-500 */
  font-weight: 900;
}

.brand-app-name {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: #2563eb;
  letter-spacing: -0.02em;
}

.brand-badge {
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.btn svg,
.panel-title svg,
.modal-title svg {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.btn-success {
  background: #059669;
  color: #ffffff;
}
.btn-success:hover {
  background: #047857;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.35);
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}
.btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}
.btn-danger:hover {
  background: #fecaca;
}

.btn-sm {
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
}

/* ============================================================= */
/* Main Layout Container                                         */
/* ============================================================= */
.app-main {
  flex: 1;
  display: flex;
  padding: 1.25rem;
  gap: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Left Panel: Preview & Customization */
.app-sidebar {
  width: 440px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Right Panel: Student List & Controls */
.app-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Panels / Cards */
.card-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.2rem;
}

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

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ============================================================= */
/* 3D Interactive Card Preview Area                              */
/* ============================================================= */
.preview-stage {
  perspective: 1200px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0.5rem;
  background: radial-gradient(circle at center, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: var(--radius-md);
  border: 1px dashed #cbd5e1;
  min-height: 250px;
  position: relative;
}

.card-flip-container {
  position: relative;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  cursor: pointer;
  transform: scale(1.08);
}

.card-flip-container.flipped {
  transform: scale(1.08) rotateY(180deg);
}

.card-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-face.front {
  position: relative;
  z-index: 2;
}

.card-face.back {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotateY(180deg);
  z-index: 1;
}

.flip-hint {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 0.72rem;
  color: #64748b;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  padding: 3px 8px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Student Navigation in Preview */
.preview-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.current-student-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

/* Form Controls & Selectors */
.control-group {
  margin-bottom: 0.85rem;
}

.control-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-select,
.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  background-color: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-select:focus,
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Theme Picker Strip (10 Swatches Side-by-Side) */
.theme-picker-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

.theme-circle-btn {
  width: 25px;
  height: 25px;
  min-width: 25px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  position: relative;
  outline: none;
  padding: 0;
  flex-shrink: 0;
}

.theme-circle-btn:hover {
  transform: scale(1.22);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.theme-circle-btn.active {
  transform: scale(1.28);
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #0f172a, 0 3px 8px rgba(0, 0, 0, 0.4);
  z-index: 3;
}

/* ============================================================= */
/* Student Roster Table & Search                                */
/* ============================================================= */
.roster-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-container {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-input {
  width: 100%;
  padding: 0.55rem 0.75rem 0.55rem 2.2rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  outline: none;
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Student Table */
.table-wrapper {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
  max-height: 600px;
}

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

.student-table th {
  background: #f8fafc;
  padding: 0.65rem 0.85rem;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.sortable-th {
  user-select: none;
  transition: background-color 0.15s ease;
}

.sortable-th:hover {
  background-color: #e2e8f0 !important;
  color: #0f172a;
}

.student-table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.student-table tr:hover {
  background-color: #f1f5f9;
}

.student-table tr.selected {
  background-color: #eff6ff;
}

.student-avatar {
  width: 34px;
  height: 42px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid #cbd5e1;
  display: block;
}

.student-avatar-empty {
  width: 34px;
  height: 42px;
  border-radius: 4px;
  background-color: #f8fafc;
  border: 1px dashed #cbd5e1;
  box-sizing: border-box;
}

.table-student-name {
  font-weight: 700;
  color: #0f172a;
}

.table-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
}

.action-btn-group {
  display: flex;
  gap: 0.35rem;
}

/* ============================================================= */
/* Drag & Drop PDF Upload Area                                   */
/* ============================================================= */
.upload-dropzone {
  border: 2px dashed #93c5fd;
  background-color: #eff6ff;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--primary);
  background-color: #dbeafe;
}

.dropzone-icon {
  font-size: 2.2rem;
}

.dropzone-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e40af;
}

.dropzone-subtitle {
  font-size: 0.78rem;
  color: #64748b;
}

/* ============================================================= */
/* Modals & Dialogs                                              */
/* ============================================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #64748b;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  margin-top: 1.2rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  background: #1e293b;
  color: #ffffff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================= */
/* Admin Login Overlay Screen                                    */
/* ============================================================= */
.login-overlay-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #090d16 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
  box-sizing: border-box;
}

.login-overlay-screen.hidden {
  display: none !important;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 14px;
  padding: 2.2rem 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: fadeInDown 0.35s ease;
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-brand-icon {
  width: 54px;
  height: 54px;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.85rem;
  border: 1px solid #bfdbfe;
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.25rem;
}

.login-school-title {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
}

.login-error-alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-15px); }
  to { opacity: 1; transform: translateY(0); }
}
