/* ============================================
   SARC Notes v2 - Main Stylesheet
   Modern · Minimal · Lightweight · Monochrome
   ============================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --dark: #0f172a;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.08);
  --transition: all .18s ease;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --primary-light: #1e3a8a;
  --shadow: 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border: none; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 14px; cursor: pointer;
  transition: var(--transition); text-decoration: none;
  font-family: inherit; line-height: 1;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover { background: #1e293b; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; background: var(--card); color: var(--text);
  transition: var(--transition); font-family: inherit;
}
.form-control:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

/* === Cards === */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; display:flex;align-items:center;gap:8px; }
.card-compact { padding: 14px; }

/* === Alerts === */
.alert {
  padding: 11px 14px; border-radius: var(--radius-sm);
  margin-bottom: 16px; font-size: 14px;
}
.alert-success { background: #d1fae5; color: #065f46; border-left: 3px solid var(--success); }
.alert-danger { background: #fee2e2; color: #991b1b; border-left: 3px solid var(--danger); }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border-left: 3px solid var(--primary); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 3px solid var(--warning); }

/* === Container === */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ============================================
   LANDING PAGE
   ============================================ */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .navbar { background: rgba(15,23,42,.92); }
.nav-wrap { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; max-width: 1200px; margin: 0 auto; }
.logo { font-size: 18px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo-icon { width: 30px; height: 30px; background: var(--primary); color: #fff; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.nav-menu { display: flex; gap: 24px; align-items: center; list-style: none; }
.nav-menu a { color: var(--text); font-size: 14px; font-weight: 500; }
.nav-menu a:hover { color: var(--primary); }
.nav-actions { display: flex; gap: 8px; align-items: center; }
.menu-toggle { display: none; background: none; border: none; cursor: pointer; font-size: 22px; color: var(--text); }

.hero { padding: 70px 0 50px; text-align: center; }
.hero-badge { display: inline-block; padding: 5px 12px; background: var(--primary-light); color: var(--primary-dark); border-radius: 999px; font-size: 12px; font-weight: 500; margin-bottom: 18px; }
.hero h1 { font-size: 48px; font-weight: 800; line-height: 1.1; margin-bottom: 16px; letter-spacing: -.8px; }
.hero h1 span { color: var(--primary); }
.hero p { font-size: 17px; color: var(--muted); max-width: 580px; margin: 0 auto 26px; }
.hero-cta { display: flex; gap: 10px; justify-content: center; margin-bottom: 40px; flex-wrap: wrap; }
.hero-mockup { max-width: 900px; margin: 0 auto; border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; }

.section { padding: 60px 0; }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head h2 { font-size: 32px; font-weight: 700; margin-bottom: 10px; letter-spacing: -.4px; }
.section-head p { color: var(--muted); font-size: 15px; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.feature-card { background: var(--card); padding: 22px; border-radius: var(--radius); border: 1px solid var(--border); transition: var(--transition); }
.feature-card:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: var(--shadow); }
.feature-icon { width: 40px; height: 40px; background: var(--primary-light); color: var(--primary); border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 14px; }
.feature-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.feature-card p { color: var(--muted); font-size: 14px; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.step-card { text-align: center; padding: 20px; }
.step-num { width: 44px; height: 44px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; margin: 0 auto 14px; }
.step-card h4 { font-size: 16px; margin-bottom: 6px; }
.step-card p { color: var(--muted); font-size: 14px; }

.testimonials-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.testimonial { background: var(--card); padding: 22px; border-radius: var(--radius); border: 1px solid var(--border); }
.testimonial-text { font-size: 14px; margin-bottom: 14px; color: var(--text); }
.testimonial-author { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.testimonial-author strong { display: block; font-size: 13px; }
.testimonial-author span { font-size: 12px; color: var(--muted); }

.faq-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; overflow: hidden; }
.faq-q { padding: 14px 18px; font-weight: 500; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.faq-a { padding: 0 18px; max-height: 0; overflow: hidden; transition: all .25s; color: var(--muted); font-size: 14px; }
.faq-item.active .faq-a { padding: 0 18px 14px; max-height: 280px; }
.faq-item.active .faq-q::after { transform: rotate(180deg); }
.faq-q::after { content: '⌄'; transition: transform .25s; font-size: 16px; }

.footer { background: var(--dark); color: #cbd5e1; padding: 40px 0 18px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 24px; }
.footer h5 { color: #fff; margin-bottom: 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.footer ul { list-style: none; }
.footer ul li { margin-bottom: 7px; }
.footer ul a { color: #cbd5e1; font-size: 14px; }
.footer ul a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #334155; padding-top: 18px; text-align: center; font-size: 12px; color: #94a3b8; }

/* ============================================
   AUTH
   ============================================ */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--card); padding: 32px; border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.auth-card .logo { justify-content: center; margin-bottom: 22px; }
.auth-card h2 { font-size: 21px; font-weight: 700; margin-bottom: 4px; text-align: center; }
.auth-card .auth-sub { color: var(--muted); font-size: 14px; text-align: center; margin-bottom: 24px; }
.auth-footer { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; background: var(--card); border-right: 1px solid var(--border);
  position: fixed; left: 0; top: 0; bottom: 0; overflow-y: auto;
  transition: transform .25s ease; z-index: 50;
}
.sidebar-header { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.sidebar-nav { padding: 12px 10px 80px; }
.sidebar-section { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 12px 10px 4px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text);
  font-size: 14px; font-weight: 500; margin-bottom: 1px; transition: var(--transition);
}
.sidebar-link:hover { background: var(--bg); color: var(--primary); }
.sidebar-link.active { background: var(--primary-light); color: var(--primary); }
.sidebar-link i { width: 16px; font-size: 14px; }
.sidebar-link .sb-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 999px; }

.main-area { flex: 1; margin-left: 240px; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px; display: flex; align-items: center; justify-content: space-between;
}
[data-theme="dark"] .topbar { background: rgba(30,41,59,.92); }
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; max-width: 500px; }
.search-box { position: relative; flex: 1; }
.search-box input { width: 100%; padding: 8px 12px 8px 36px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); font-size: 14px; color: var(--text); }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 6px; box-shadow: var(--shadow-lg); display: none; max-height: 420px; overflow-y: auto; z-index: 60; }
.search-results.show { display: block; }
.search-result-item { display: block; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; color: var(--text); }
.search-result-item:hover { background: var(--bg); }
.search-result-item:last-child { border: none; }
.search-result-item small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 36px; height: 36px; border: 1px solid var(--border); background: var(--card); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); position: relative; transition: var(--transition); }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.notif-dot { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid var(--card); }

.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 220px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60; }
.dropdown-menu.show { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: 14px; cursor: pointer; }
.dropdown-item:hover { background: var(--bg); color: var(--primary); }
.profile-btn { display: flex; align-items: center; gap: 7px; padding: 5px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; color: var(--text); }

.content { padding: 22px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.2px; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* === Stat Cards === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--card); padding: 18px; border-radius: var(--radius); border: 1px solid var(--border); }
.stat-card .stat-icon { width: 38px; height: 38px; background: var(--primary-light); color: var(--primary); border-radius: 9px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; font-size: 17px; }
.stat-card h4 { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
.stat-card .stat-num { font-size: 24px; font-weight: 700; }
.stat-card .stat-trend { font-size: 11px; color: var(--success); margin-top: 4px; }

/* === Note Cards === */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.note-card { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); transition: var(--transition); display:flex; flex-direction:column; }
.note-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.note-cover { height: 120px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 30px; position: relative; }
.note-cover img { width: 100%; height: 100%; object-fit: cover; }
.note-pin { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.2); padding: 3px 7px; border-radius: 4px; font-size: 10px; }
.note-body { padding: 14px; flex:1; }
.note-meta { display: flex; gap: 8px; font-size: 11px; color: var(--muted); margin-bottom: 6px; align-items:center; flex-wrap:wrap; }
.note-card h4 { font-size: 15px; margin-bottom: 6px; line-height: 1.3; }
.note-card h4 a { color: var(--text); }
.note-card h4 a:hover { color: var(--primary); }
.note-footer { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

/* === Tables === */
.table-wrap { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 14px; text-align: left; font-size: 14px; }
.table th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.table tr { border-bottom: 1px solid var(--border); }
.table tr:last-child { border: none; }
.table tbody tr:hover { background: var(--bg); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-muted { background: var(--bg); color: var(--muted); border:1px solid var(--border); }

/* === Note Reader === */
.note-reader { max-width: 820px; margin: 0 auto; background: var(--card); padding: 36px; border-radius: var(--radius); border: 1px solid var(--border); }
.note-reader h1 { font-size: 28px; line-height: 1.2; margin-bottom: 14px; }
.note-reader-meta { display: flex; gap: 14px; color: var(--muted); font-size: 12px; margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items:center; }
.note-actions { display: flex; gap: 8px; margin: 18px 0; flex-wrap: wrap; }
.note-content { font-size: 15px; line-height: 1.75; }
.note-content h2 { margin: 22px 0 10px; font-size: 22px; }
.note-content h3 { margin: 18px 0 8px; font-size: 18px; }
.note-content p { margin-bottom: 14px; }
.note-content img { border-radius: var(--radius-sm); margin: 14px 0; }
.note-content pre { background: var(--dark); color: #f1f5f9; padding: 14px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 13px; }
.note-content code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.note-content ul, .note-content ol { margin: 10px 0 14px 22px; }

/* === Comments === */
.comment-list { margin-top: 26px; }
.comment { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; }
.comment-header { display: flex; gap: 9px; align-items: center; margin-bottom: 7px; flex-wrap:wrap; }
.comment-header strong { font-size: 13px; }
.comment-header span { font-size: 11px; color: var(--muted); }
.comment-body { font-size: 14px; }
.comment-reply { margin-left: 26px; margin-top: 8px; background: var(--bg); }

/* === Modal === */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.modal.show { display: flex; }
.modal-content { background: var(--card); border-radius: var(--radius); width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* === Toast === */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--primary); padding: 10px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); min-width: 260px; font-size: 14px; animation: slideIn .25s; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === Empty State === */
.empty-state { text-align: center; padding: 50px 20px; }
.empty-state i { font-size: 42px; color: var(--muted); margin-bottom: 14px; }
.empty-state h4 { font-size: 17px; margin-bottom: 5px; }
.empty-state p { color: var(--muted); font-size: 14px; }

/* === Skeleton === */
.skeleton { background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 4px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* === Bottom Nav (Mobile) === */
.bottom-nav { display: none; }

/* === NEW v2 COMPONENTS === */

/* Tooltip (lightweight, CSS only) */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--dark); color: #fff; padding: 5px 9px; border-radius: 5px;
  font-size: 11px; white-space: nowrap; z-index: 100; pointer-events: none;
}

/* Pagination */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 22px; flex-wrap:wrap; }
.page-link { padding: 6px 11px; background: var(--card); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; }
.page-link:hover { border-color: var(--primary); color: var(--primary); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Notification rows */
.notif-row { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--text); transition: var(--transition); }
.notif-row:last-child { border: none; }
.notif-row:hover { background: var(--bg); }
.notif-row.unread { background: rgba(37,99,235,.04); }
.notif-icon { width: 36px; height: 36px; background: var(--primary-light); color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* XP Bar */
.xp-bar { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.xp-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); transition: width .4s ease; }

/* Badge tiles */
.badge-tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.badge-tile .b-icon { width: 50px; height: 50px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 10px; }
.badge-tile h5 { font-size: 13px; margin-bottom: 3px; }
.badge-tile p { font-size: 11px; color: var(--muted); }

/* Flashcard */
.flashcard { perspective: 1000px; height: 220px; cursor: pointer; }
.flashcard-inner { position: relative; width: 100%; height: 100%; text-align: center; transition: transform .5s; transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; padding: 22px; display: flex; flex-direction: column; justify-content: center; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.flashcard-back { transform: rotateY(180deg); background: var(--primary-light); }

/* Voice recorder */
.voice-recorder { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; }
.voice-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.voice-btn.recording { background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); } 50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); } }
.voice-time { font-family: monospace; font-size: 12px; color: var(--muted); min-width: 40px; }

/* File preview */
.file-preview { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; display: flex; gap: 10px; align-items: center; }
.file-preview .fp-icon { width: 40px; height: 40px; background: var(--primary-light); color: var(--primary); border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-preview .fp-info { flex: 1; min-width: 0; }
.file-preview .fp-info strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview .fp-info small { font-size: 11px; color: var(--muted); }

/* View More toggle */
.view-more { display: inline-flex; align-items: center; gap: 5px; padding: 6px 0; font-size: 13px; color: var(--primary); cursor: pointer; font-weight: 500; }
.view-more:hover { text-decoration: underline; }
.collapsible { max-height: 200px; overflow: hidden; position: relative; transition: max-height .3s; }
.collapsible.expanded { max-height: 4000px; }
.collapsible:not(.expanded)::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 40px; background: linear-gradient(transparent, var(--card)); pointer-events: none; }

/* Progress bar (used in lots of places) */
.progress-bar { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); transition: width .3s; }

/* Tab strip */
.tab-strip { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab-item { padding: 10px 14px; border: none; background: transparent; color: var(--muted); font-weight: 500; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Chip / filter chip */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; background: var(--card); border: 1px solid var(--border); border-radius: 999px; font-size: 12px; cursor: pointer; transition: var(--transition); }
.chip:hover, .chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Streak indicator */
.streak-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; background: #fef3c7; color: #92400e; border-radius: 999px; font-size: 12px; font-weight: 600; }

/* Heatmap */
.heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.heatmap-cell { aspect-ratio: 1; border-radius: 3px; background: var(--bg); }
.heatmap-cell.l1 { background: #c7d2fe; }
.heatmap-cell.l2 { background: #93c5fd; }
.heatmap-cell.l3 { background: #3b82f6; }
.heatmap-cell.l4 { background: #1d4ed8; }

/* Assignment row */
.assignment-row { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); margin-bottom: 10px; transition: var(--transition); }
.assignment-row:hover { border-color: var(--primary); }
.assignment-row .a-meta { display:flex; gap:10px; flex-wrap:wrap; font-size:12px; color:var(--muted); margin-top:5px; }
.deadline { font-size: 12px; padding: 3px 9px; border-radius: 4px; }
.deadline.urgent { background: #fee2e2; color: #991b1b; }
.deadline.upcoming { background: #fef3c7; color: #92400e; }
.deadline.normal { background: var(--bg); color: var(--muted); }

/* PDF viewer wrapper */
.pdf-viewer { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.pdf-viewer canvas, .pdf-viewer iframe { width: 100%; max-height: 75vh; border-radius: var(--radius-sm); }

/* Responsive grid for forms */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* === Responsive === */
@media (max-width: 992px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 36px; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-menu { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--card); flex-direction: column; padding: 14px; border-bottom: 1px solid var(--border); }
  .nav-menu.show { display: flex; }
  .menu-toggle { display: block; }
  .hero h1 { font-size: 30px; }
  .hero p { font-size: 15px; }
  .section-head h2 { font-size: 24px; }
  .footer-grid { grid-template-columns: 1fr; }

  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); box-shadow: 8px 0 20px rgba(0,0,0,.15); }
  .main-area { margin-left: 0; padding-bottom: 70px; }
  .content { padding: 14px; }
  .note-reader { padding: 20px; }
  .topbar { padding: 9px 14px; }
  .page-title { font-size: 19px; }
  .stat-card .stat-num { font-size: 21px; }

  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--border); padding: 7px 0; z-index: 50; justify-content: space-around; }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 10px; padding: 5px; min-width: 50px; }
  .bottom-nav a.active, .bottom-nav a:hover { color: var(--primary); }
  .bottom-nav a i { font-size: 17px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 40px 0 26px; }
  .notes-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 26px; }
  .modal-content { max-width: 95%; }
}

/* Print */
@media print {
  .sidebar, .topbar, .bottom-nav, .note-actions, .footer { display: none !important; }
  .main-area { margin-left: 0 !important; }
}
