/* ── EduConnect Principal Portal — style.css ──────────────────────────────── */
:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --bg: #0f1117;
  --bg-card: #1a1d28;
  --bg-card-hover: #22263a;
  --bg-sidebar: #141621;
  --bg-input: #1e2133;
  --border: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(99, 102, 241, 0.5);
  --text: #e8eaed;
  --text-secondary: #8b8fa5;
  --text-muted: #555870;
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --sidebar-w: 260px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 32px rgba(0, 0, 0, 0.25);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Screens ─────────────────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: flex; min-height: 100vh; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-container {
  display: flex; align-items: center; justify-content: center;
  flex: 1; padding: 20px;
  background: radial-gradient(ellipse at top, rgba(99, 102, 241, 0.08) 0%, transparent 60%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow), 0 0 80px rgba(99, 102, 241, 0.05);
  animation: fadeInUp 0.5s ease;
}

.login-header {
  text-align: center; margin-bottom: 32px;
}

.login-icon {
  font-size: 48px; margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
}

.login-header h1, .login-header h2 {
  font-size: 1.6rem; font-weight: 700; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--primary-light), #a5b4fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-header p {
  color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block; font-size: 0.82rem; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.form-group input, .form-group textarea, .form-group select,
.form-input, input[type="text"], input[type="password"], input[type="email"], input[type="url"],
input[type="number"], input[type="date"], input[type="datetime-local"], textarea, select {
  width: 100%; padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus,
.form-input:focus, input:focus, textarea:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input::placeholder, textarea::placeholder, input::placeholder {
  color: var(--text-muted);
}

.error-msg {
  color: var(--danger); font-size: 0.85rem; min-height: 20px;
  margin-bottom: 8px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary-light);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid transparent;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn-full { width: 100%; justify-content: center; }

.btn-sm {
  padding: 5px 8px; font-size: 0.8rem;
  border-radius: 6px;
}

.btn-loader {
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
#dashboard-screen.active { display: flex; }

.sidebar {
  width: var(--sidebar-w); min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 28px 20px 10px;
  text-align: center;
}

.sidebar-logo {
  font-size: 32px; margin-bottom: 4px;
  filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.4));
}

.sidebar-header h2 {
  font-size: 1.2rem; font-weight: 700; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--primary-light), #a5b4fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-subtitle {
  font-size: 0.75rem; color: var(--text-muted); margin-top: 2px;
}

.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; margin: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; color: white;
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-college { font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-menu {
  list-style: none; flex: 1; overflow-y: auto;
  padding: 8px 12px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.88rem; font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text);
}

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

.nav-item .material-icons-round { font-size: 20px; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); }

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w); flex: 1;
  display: flex; flex-direction: column; min-height: 100vh;
}

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
  background: rgba(15, 17, 23, 0.8);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50;
}

.topbar h2 { font-size: 1.15rem; font-weight: 600; flex: 1; }
.menu-toggle { display: none; background: none; border: none; color: var(--text); cursor: pointer; }

.user-badge {
  padding: 5px 14px; background: var(--primary-glow);
  color: var(--primary-light); border-radius: 20px;
  font-size: 0.82rem; font-weight: 500;
}

.content-area { padding: 24px 28px; flex: 1; }

/* ── Pages ────────────────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.page-header h3 { font-size: 1.2rem; font-weight: 600; }
.page-header h4 { font-size: 1rem; font-weight: 600; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Stats ────────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}

.stat-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  transition: transform var(--transition);
}
.stat-card:hover { transform: translateY(-2px); }

.stat-card .material-icons-round { font-size: 36px; opacity: 0.8; }
.stat-value { font-size: 1.5rem; font-weight: 700; display: block; }
.stat-label { font-size: 0.82rem; color: var(--text-secondary); }

.stat-purple .material-icons-round { color: #a78bfa; }
.stat-purple { border-color: rgba(167, 139, 250, 0.2); background: linear-gradient(135deg, rgba(167, 139, 250, 0.08), transparent); }
.stat-blue .material-icons-round { color: #60a5fa; }
.stat-blue { border-color: rgba(96, 165, 250, 0.2); background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), transparent); }
.stat-green .material-icons-round { color: #34d399; }
.stat-green { border-color: rgba(52, 211, 153, 0.2); background: linear-gradient(135deg, rgba(52, 211, 153, 0.08), transparent); }
.stat-orange .material-icons-round { color: #fbbf24; }
.stat-orange { border-color: rgba(251, 191, 36, 0.2); background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), transparent); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  margin-bottom: 16px;
}

.card h3, .card h4 { margin-bottom: 16px; }

/* ── Quick Actions ────────────────────────────────────────────────────────── */
.quick-actions {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}

.action-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 12px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  font-family: inherit; font-size: 0.88rem; font-weight: 500; color: var(--text);
  transition: all var(--transition);
}
.action-card:hover {
  background: var(--bg-card-hover); border-color: var(--primary-light);
  transform: translateY(-2px);
}
.action-card .material-icons-round { font-size: 28px; color: var(--primary-light); }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-container { overflow-x: auto; }

table {
  width: 100%; border-collapse: collapse; font-size: 0.88rem;
}

thead th {
  padding: 10px 12px; text-align: left;
  font-weight: 600; font-size: 0.8rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.5px;
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(99, 102, 241, 0.04); }
.empty-msg { text-align: center; color: var(--text-secondary); padding: 32px !important; }

.action-btns { display: flex; gap: 4px; }

/* ── Search Bar ───────────────────────────────────────────────────────────── */
.search-bar {
  margin-bottom: 16px;
}

.search-bar input[type="text"] {
  flex: 1; padding: 10px 14px; border-radius: var(--radius-sm);
}

/* ── HOD Cards ────────────────────────────────────────────────────────────── */
.hod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }

.hod-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: all var(--transition);
}
.hod-card:hover { border-color: var(--primary); }

.icon-wrap {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-wrap.assigned { background: var(--success-bg); color: var(--success); }
.icon-wrap.unassigned { background: var(--warning-bg); color: var(--warning); }

.hod-info { flex: 1; min-width: 0; }
.dept-name { font-weight: 600; font-size: 0.95rem; }
.hod-name { font-size: 0.82rem; color: var(--text-secondary); }

.hod-actions { display: flex; gap: 6px; align-items: center; }
.hod-actions select {
  padding: 6px 10px; font-size: 0.82rem; max-width: 160px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
}

/* ── Marks Cards ──────────────────────────────────────────────────────────── */
.marks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }

.marks-card {
  padding: 20px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
}

.paper-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.paper-name { font-weight: 600; font-size: 0.95rem; }
.paper-code { font-size: 0.8rem; color: var(--primary-light); background: var(--primary-glow); padding: 2px 10px; border-radius: 12px; }
.class-name { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 12px; }

.progress-bar {
  width: 100%; height: 6px; background: rgba(255,255,255,0.06);
  border-radius: 3px; overflow: hidden; margin-bottom: 6px;
}
.progress-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.5s ease;
}

.stats-text { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 10px; }

.lock-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lock-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 12px;
  font-size: 0.78rem; font-weight: 500; cursor: pointer;
  transition: all var(--transition);
}
.lock-chip.locked { background: var(--danger-bg); color: var(--danger); }
.lock-chip.open { background: var(--success-bg); color: var(--success); }
.lock-chip:hover { opacity: 0.8; }

/* ── Links Cards ──────────────────────────────────────────────────────────── */
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.link-card {
  padding: 20px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color var(--transition);
}
.link-card:hover { border-color: var(--primary-light); }
.link-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.link-card h4 { font-size: 1rem; }
.link-card p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; }
.link-card a { color: var(--primary-light); font-size: 0.85rem; word-break: break-all; text-decoration: none; }
.link-card a:hover { text-decoration: underline; }

/* ── Notification Card ────────────────────────────────────────────────────── */
.notif-card {
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.notif-title { font-weight: 600; font-size: 0.95rem; }
.notif-meta { font-size: 0.78rem; color: var(--text-secondary); margin: 2px 0 6px; }
.notif-msg { font-size: 0.88rem; color: var(--text); }

/* ── Feedback Cards ───────────────────────────────────────────────────────── */
.feedback-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }

.feedback-card {
  padding: 20px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.feedback-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.feedback-type {
  padding: 3px 12px; border-radius: 12px; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.type-rating { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.type-remark { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.feedback-text { font-size: 0.95rem; margin-bottom: 8px; }
.feedback-meta { font-size: 0.78rem; color: var(--text-secondary); }

/* ── Form Cards ───────────────────────────────────────────────────────────── */
.forms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }

.form-card {
  padding: 20px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color var(--transition);
}
.form-card:hover { border-color: var(--primary-light); }
.form-card h4 { color: var(--primary-light); margin-bottom: 4px; }
.form-card p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; }
.form-meta { font-size: 0.78rem; color: var(--text-muted); }

/* ── Notices Grid ─────────────────────────────────────────────────────────── */
.notices-grid { display: grid; grid-template-columns: 1fr; gap: 0; }

/* ── Form Grid & Row ──────────────────────────────────────────────────────── */
.form-grid { max-width: 640px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; width: 100%; max-width: 580px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
  animation: fadeInUp 0.3s ease;
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-card); z-index: 1;
  border-radius: 16px 16px 0 0;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-secondary); cursor: pointer; }
.modal-close:hover { color: var(--text); }

#modal-body { padding: 24px; }
.modal-form { display: flex; flex-direction: column; gap: 4px; }

/* ── Form Builder ─────────────────────────────────────────────────────────── */
.fb-question-card {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px;
}
.fb-q-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.fb-q-num { font-weight: 700; font-size: 0.85rem; color: var(--primary-light); }
.fb-option-row { display: flex; gap: 8px; margin-bottom: 6px; align-items: center; }
.fb-option-row input { flex: 1; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%);
  padding: 12px 28px; border-radius: 12px;
  font-size: 0.9rem; font-weight: 500;
  z-index: 10000; transition: bottom 0.3s ease;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  max-width: 480px; text-align: center;
}
.toast.show { bottom: 32px; }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.primary { border-color: var(--primary); color: var(--primary-light); }

/* ── Upload Button ────────────────────────────────────────────────────────── */
.upload-btn { position: relative; overflow: hidden; }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.mb-4 { margin-bottom: 24px; }
.mt-4 { margin-top: 24px; }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed; z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hod-grid, .marks-grid, .feedback-grid, .forms-grid, .links-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .form-row { flex-direction: column; gap: 0; }
  .login-card { padding: 32px 24px; }
  .content-area { padding: 16px; }
  .modal-card { max-width: 100%; margin: 8px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 12px 16px; }
  .topbar h2 { font-size: 1rem; }
}
