/* Neo EduAI — Shared Styles */
:root {
  --primary: #1A73E8;
  --primary-dark: #1557B0;
  --primary-light: #E8F0FE;
  --success: #34A853;
  --warning: #FBBC04;
  --danger: #EA4335;
  --bg: #F8F9FA;
  --surface: #FFFFFF;
  --surface-hover: #F1F3F4;
  --border: #DADCE0;
  --text: #202124;
  --text-secondary: #5F6368;
  --text-muted: #80868B;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition: .2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.main-content { margin-left: 260px; flex: 1; padding: 32px; max-width: 1200px; }

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar-brand { padding: 24px 20px; border-bottom: 1px solid var(--border); }
.sidebar-brand h1 { font-size: 1.25rem; color: var(--primary); font-weight: 700; }
.sidebar-brand span { font-size: .75rem; color: var(--text-muted); display: block; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 8px 20px 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: var(--text-secondary); font-size: .9rem; cursor: pointer; transition: background var(--transition); border: none; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: var(--surface-hover); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.sidebar-footer .user-info { display: flex; align-items: center; gap: 10px; }
.sidebar-footer .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem; }
.sidebar-footer .user-meta { flex: 1; min-width: 0; }
.sidebar-footer .user-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .user-role { font-size: .7rem; color: var(--text-muted); text-transform: capitalize; }

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 24px; box-shadow: var(--shadow); transition: box-shadow var(--transition); }
.card:hover { box-shadow: var(--shadow-md); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-title { font-size: 1.1rem; font-weight: 600; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500; cursor: pointer; border: none; transition: all var(--transition); font-family: var(--font); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-icon { padding: 8px; border-radius: 50%; width: 36px; height: 36px; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }
.form-input { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .9rem; font-family: var(--font); transition: border var(--transition); outline: none; }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.15); }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input { cursor: pointer; }

/* ─── Login Page ──────────────────────────────────────────────────────────── */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1A73E8 0%, #0D47A1 100%); }
.login-card { background: var(--surface); border-radius: 16px; padding: 48px 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.login-card h2 { font-size: 1.5rem; margin-bottom: 4px; }
.login-card p { color: var(--text-muted); margin-bottom: 32px; font-size: .9rem; }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.login-logo span { font-size: 1.3rem; font-weight: 700; color: var(--primary); }

/* ─── Page Header ─────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.page-header p { color: var(--text-muted); font-size: .9rem; }

/* ─── Stats Grid ──────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 20px; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* ─── Data Table ──────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 16px; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-bottom: 2px solid var(--border); font-weight: 600; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .875rem; vertical-align: middle; }
tr:hover td { background: var(--surface-hover); }

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.badge-success { background: #E6F4EA; color: #1E8E3E; }
.badge-warning { background: #FEF7E0; color: #B06000; }
.badge-danger { background: #FCE8E6; color: #D93025; }
.badge-info { background: var(--primary-light); color: var(--primary); }
.badge-muted { background: #F1F3F4; color: var(--text-muted); }

/* ─── Chat ────────────────────────────────────────────────────────────────── */
.chat-container { display: flex; flex-direction: column; height: 500px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.chat-msg { max-width: 80%; }
.chat-msg.user { align-self: flex-end; }
.chat-msg.model { align-self: flex-start; }
.chat-bubble { padding: 12px 16px; border-radius: 16px; font-size: .9rem; line-height: 1.5; }
.chat-msg.user .chat-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.chat-msg.model .chat-bubble { background: #F1F3F4; color: var(--text); border-bottom-left-radius: 4px; }
.chat-time { font-size: .7rem; color: var(--text-muted); margin-top: 4px; }
.chat-input-area { display: flex; gap: 8px; padding: 16px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-input-area input { flex: 1; }

/* ─── Material Detail ─────────────────────────────────────────────────────── */
.material-summary { white-space: pre-line; line-height: 1.7; font-size: .9rem; }
.pdf-viewer { width: 100%; height: 600px; border: 1px solid var(--border); border-radius: var(--radius); }

/* ─── Grid Layouts ────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 32px; max-width: 500px; width: 90%; box-shadow: var(--shadow-lg); }
.modal h3 { margin-bottom: 16px; }

/* ─── Upload Area ─────────────────────────────────────────────────────────── */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 40px; text-align: center; cursor: pointer; transition: all var(--transition); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-zone p { color: var(--text-muted); margin-top: 8px; font-size: .85rem; }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Utilities ───────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .85rem; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .875rem; }
.alert-danger { background: #FCE8E6; color: #D93025; }
.alert-success { background: #E6F4EA; color: #1E8E3E; }
