/* ============================================
   SARC Notes - Main Stylesheet
   Modern Minimal SaaS Design
   ============================================ */

: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: 12px;
  --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 .2s ease;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --primary-light: #1e3a8a;
}

* { 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 .3s, color .3s;
}

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 18px; border: none; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 14px; cursor: pointer;
  transition: var(--transition); text-decoration: none;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); }
.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-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* === Forms === */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%; padding: 11px 14px;
  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,.1);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* === Cards === */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-title { font-size: 18px; font-weight: 600; margin-bottom: 14px; }

/* === Alerts === */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 18px; 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); }

/* === 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,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .navbar { background: rgba(15,23,42,.85); }
.nav-wrap { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; max-width: 1200px; margin: 0 auto; }
.logo { font-size: 20px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo-icon { width: 32px; height: 32px; background: var(--primary); color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.nav-menu { display: flex; gap: 28px; 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: 10px; align-items: center; }
.menu-toggle { display: none; background: none; border: none; cursor: pointer; font-size: 22px; color: var(--text); }

.hero { padding: 80px 0 60px; text-align: center; position: relative; overflow: hidden; }
.hero-badge { display: inline-block; padding: 6px 14px; background: var(--primary-light); color: var(--primary-dark); border-radius: 999px; font-size: 13px; font-weight: 500; margin-bottom: 20px; }
.hero h1 { font-size: 54px; font-weight: 800; line-height: 1.1; margin-bottom: 18px; letter-spacing: -1px; }
.hero h1 span { color: var(--primary); }
.hero p { font-size: 18px; color: var(--muted); max-width: 600px; margin: 0 auto 30px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; margin-bottom: 50px; 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: 70px 0; }
.section-head { text-align: center; margin-bottom: 50px; }
.section-head h2 { font-size: 36px; font-weight: 700; margin-bottom: 12px; letter-spacing: -.5px; }
.section-head p { color: var(--muted); font-size: 16px; }

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

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

.testimonials-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.testimonial { background: var(--card); padding: 26px; border-radius: var(--radius); border: 1px solid var(--border); }
.testimonial-text { font-size: 15px; margin-bottom: 16px; color: var(--text); }
.testimonial-author { display: flex; align-items: center; gap: 12px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.testimonial-author strong { display: block; font-size: 14px; }
.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: 10px; overflow: hidden; }
.faq-q { padding: 16px 20px; font-weight: 500; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.faq-a { padding: 0 20px; max-height: 0; overflow: hidden; transition: all .3s; color: var(--muted); font-size: 14px; }
.faq-item.active .faq-a { padding: 0 20px 16px; max-height: 200px; }
.faq-item.active .faq-q::after { transform: rotate(180deg); }
.faq-q::after { content: '⌄'; transition: transform .3s; font-size: 18px; }

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

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

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

.sidebar {
  width: 250px; background: var(--card); border-right: 1px solid var(--border);
  position: fixed; left: 0; top: 0; bottom: 0; overflow-y: auto;
  transition: transform .3s ease; z-index: 50;
}
.sidebar-header { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.sidebar-nav { padding: 16px 12px; }
.sidebar-section { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 12px 12px 6px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text);
  font-size: 14px; font-weight: 500; margin-bottom: 2px; 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: 18px; font-size: 16px; }

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

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px; display: flex; align-items: center; justify-content: space-between;
}
[data-theme="dark"] .topbar { background: rgba(30,41,59,.9); }
.topbar-left { display: flex; align-items: center; gap: 16px; flex: 1; max-width: 500px; }
.search-box { position: relative; flex: 1; }
.search-box input { width: 100%; padding: 9px 14px 9px 38px; 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); }
.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: 400px; overflow-y: auto; z-index: 60; }
.search-results.show { display: block; }
.search-result-item { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.search-result-item:hover { background: var(--bg); }
.search-result-item:last-child { border: none; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.icon-btn { width: 38px; height: 38px; 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; }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.notif-dot { position: absolute; top: 6px; right: 6px; 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% + 8px); right: 0; min-width: 240px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px; display: none; z-index: 60; }
.dropdown-menu.show { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; 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: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; color: var(--text); }

.content { padding: 26px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 24px; font-weight: 700; }
.page-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* === Stat Cards === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 26px; }
.stat-card { background: var(--card); padding: 22px; border-radius: var(--radius); border: 1px solid var(--border); }
.stat-card .stat-icon { width: 44px; height: 44px; background: var(--primary-light); color: var(--primary); border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; font-size: 20px; }
.stat-card h4 { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.stat-card .stat-num { font-size: 26px; font-weight: 700; }

/* === Note Cards === */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.note-card { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); transition: var(--transition); }
.note-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.note-cover { height: 140px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 36px; position: relative; }
.note-cover img { width: 100%; height: 100%; object-fit: cover; }
.note-pin { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.2); padding: 4px 8px; border-radius: 4px; font-size: 11px; }
.note-body { padding: 16px; }
.note-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.note-card h4 { font-size: 16px; margin-bottom: 8px; 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: 12px 16px; 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; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; font-size: 14px; }
.table th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: 12px; 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 10px; 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; }

/* === Note Reader === */
.note-reader { max-width: 800px; margin: 0 auto; background: var(--card); padding: 40px; border-radius: var(--radius); border: 1px solid var(--border); }
.note-reader h1 { font-size: 32px; line-height: 1.2; margin-bottom: 16px; }
.note-reader-meta { display: flex; gap: 16px; color: var(--muted); font-size: 13px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.note-actions { display: flex; gap: 10px; margin: 20px 0; flex-wrap: wrap; }
.note-content { font-size: 16px; line-height: 1.8; }
.note-content h2 { margin: 24px 0 12px; font-size: 24px; }
.note-content h3 { margin: 20px 0 10px; font-size: 19px; }
.note-content p { margin-bottom: 16px; }
.note-content img { border-radius: var(--radius-sm); margin: 16px 0; }
.note-content pre { background: var(--dark); color: #f1f5f9; padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; }
.note-content code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 14px; }

/* === Comments === */
.comment-list { margin-top: 30px; }
.comment { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px; }
.comment-header { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.comment-header strong { font-size: 14px; }
.comment-header span { font-size: 12px; color: var(--muted); }
.comment-body { font-size: 14px; }
.comment-reply { margin-left: 30px; margin-top: 10px; 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: 20px; }
.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: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

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

/* === Empty State === */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 48px; color: var(--muted); margin-bottom: 16px; }
.empty-state h4 { font-size: 18px; margin-bottom: 6px; }
.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.5s infinite; border-radius: 4px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

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

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

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

  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-area { margin-left: 0; padding-bottom: 70px; }
  .content { padding: 16px; }
  .note-reader { padding: 22px; }

  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--border); padding: 8px 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: 11px; padding: 6px; }
  .bottom-nav a.active, .bottom-nav a:hover { color: var(--primary); }
  .bottom-nav a i { font-size: 18px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 50px 0 30px; }
}
