/**
 * OpenNotes API - Clean White Design
 * Inspired by the OpenNotes main site aesthetic
 * 
 * @version 2.0.0
 * @author NagusameCS
 * @license MIT
 */

/* ==================== CSS VARIABLES ==================== */

:root {
    /* Pure White Foundation */
    --font: "Stack Sans Headline", -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    
    /* Backgrounds */
    --bg: #f7f9fc;
    --bg-panel: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.65);
    --bg-glass-strong: rgba(255, 255, 255, 0.85);
    
    /* Text Colors */
    --text: #0f172a;
    --text-muted: #94a3b8;
    --text-secondary: #64748b;
    
    /* Accent - Subtle Blue */
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    
    /* Gold for verified/premium */
    --gold: #f59e0b;
    --gold-glow: rgba(245, 158, 11, 0.2);
    
    /* Borders */
    --border: rgba(0, 0, 0, 0.08);
    --border-soft: rgba(0, 0, 0, 0.04);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.1);
    
    /* Radius */
    --radius: 16px;
    --radius-sm: 8px;
    --radius-xs: 4px;
    --radius-pill: 999px;
    
    /* Transitions */
    --ease: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.25, 1, 0.5, 1);
    --speed: 0.2s;
    --speed-slow: 0.3s;
    
    /* Format colors */
    --c-pdf: #ef4444;
    --bg-pdf: #fef2f2;
    --c-docx: #3b82f6;
    --bg-docx: #eff6ff;
    --c-xlsx: #22c55e;
    --bg-xlsx: #f0fdf4;
    --c-pptx: #f97316;
    --bg-pptx: #fff7ed;
    
    /* Layout */
    --max-width: 1400px;
    --header-height: 72px;
}

/* ==================== BASE (scoped to avoid Tailwind conflicts) ==================== */

/* Only apply base styles inside component containers */
.notes-browser *,
.analytics-dashboard *,
.notes-browser *::before,
.notes-browser *::after,
.analytics-dashboard *::before,
.analytics-dashboard *::after {
    box-sizing: border-box;
}

/* ==================== TYPOGRAPHY (scoped to components) ==================== */

.notes-browser h1, .notes-browser h2, .notes-browser h3, 
.notes-browser h4, .notes-browser h5, .notes-browser h6,
.analytics-dashboard h1, .analytics-dashboard h2, .analytics-dashboard h3,
.analytics-dashboard h4, .analytics-dashboard h5, .analytics-dashboard h6 {
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.notes-browser p,
.analytics-dashboard p {
    color: var(--text-secondary);
}

/* ==================== BUTTONS ==================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--speed) var(--ease-smooth);
}

.btn-primary {
    background: var(--text);
    color: white;
}

.btn-primary:hover {
    background: var(--text-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--text-muted);
}

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
}

/* ==================== HEADER ==================== */

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
}

.header-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.app-logo img {
    height: 32px;
    width: auto;
}

.app-logo span {
    opacity: 0.5;
    font-weight: 400;
    margin-left: 2px;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-nav a {
    padding: 8px 16px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--speed) var(--ease-smooth);
}

.app-nav a:hover {
    color: var(--text);
    background: var(--bg);
}

.app-nav a.active {
    color: var(--text);
    background: var(--bg);
}

/* ==================== MAIN CONTENT ==================== */

.main-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 24px;
}

/* ==================== CARDS ==================== */

.card {
    background: var(--bg-panel);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all var(--speed) var(--ease-smooth);
}

.card:hover {
    box-shadow: var(--shadow);
    border-color: var(--border-soft);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-soft);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-soft);
    background: var(--bg);
}

/* ==================== HERO SECTION ==================== */

.hero {
    text-align: center;
    padding: 80px 24px;
    background: white;
    border-radius: var(--radius);
    margin-bottom: 32px;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 32px;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ==================== NOTE GRID ==================== */

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.note-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all var(--speed-slow) var(--ease);
    cursor: pointer;
}

.note-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.note-thumbnail {
    aspect-ratio: 16 / 10;
    background: var(--bg);
    overflow: hidden;
    position: relative;
}

.note-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--speed-slow) var(--ease-smooth);
}

.note-card:hover .note-thumbnail img {
    transform: scale(1.05);
}

.format-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.format-badge.pdf {
    background: var(--bg-pdf);
    color: var(--c-pdf);
}

.format-badge.docx,
.format-badge.doc {
    background: var(--bg-docx);
    color: var(--c-docx);
}

.format-badge.xlsx {
    background: var(--bg-xlsx);
    color: var(--c-xlsx);
}

.format-badge.pptx {
    background: var(--bg-pptx);
    color: var(--c-pptx);
}

.note-content {
    padding: 20px;
}

.note-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.note-author {
    display: flex;
    align-items: center;
    gap: 4px;
}

.verified-badge {
    color: var(--gold);
    font-size: 0.9rem;
}

.note-stats {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

.note-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ==================== SEARCH BAR ==================== */

.search-container {
    margin-bottom: 32px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 20px;
    transition: all var(--speed) var(--ease-smooth);
}

.search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    font-family: var(--font);
    background: transparent;
    color: var(--text);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    color: var(--text-muted);
    font-size: 1.25rem;
}

/* ==================== FILTERS ==================== */

.filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--speed) var(--ease-smooth);
}

.filter-chip:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.filter-chip.active {
    background: var(--text);
    color: white;
    border-color: var(--text);
}

/* ==================== STATS SECTION ==================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==================== LOADING STATES ==================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg) 25%,
        var(--border) 50%,
        var(--bg) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== EMPTY STATES ==================== */

.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text);
    margin-bottom: 8px;
}

/* ==================== ERROR STATES ==================== */

.error-state {
    text-align: center;
    padding: 60px 24px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.error-state h3 {
    color: var(--text);
    margin-bottom: 8px;
}

.error-state p {
    margin-bottom: 20px;
}

/* ==================== MODAL ==================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--speed) var(--ease-smooth);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--speed-slow) var(--ease);
}

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

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--speed) var(--ease-smooth);
    background: none;
    border: none;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==================== FORMS ==================== */

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

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: all var(--speed) var(--ease-smooth);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font);
    background: white;
    cursor: pointer;
}

.form-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font);
    resize: vertical;
}

/* ==================== FOOTER ==================== */

.app-footer {
    margin-top: 80px;
    padding: 40px 24px;
    background: white;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.footer-links a {
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--text);
}

/* ==================== PAGE HEADER ==================== */

.page-header {
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text);
}

/* ==================== SECTION ==================== */

.section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

/* ==================== UTILITIES ==================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* Component-specific utility classes - prefixed to avoid Tailwind conflicts */
.on-mt-1 { margin-top: 8px; }
.on-mt-2 { margin-top: 16px; }
.on-mt-3 { margin-top: 24px; }
.on-mt-4 { margin-top: 32px; }

.on-mb-1 { margin-bottom: 8px; }
.on-mb-2 { margin-bottom: 16px; }
.on-mb-3 { margin-bottom: 24px; }
.on-mb-4 { margin-bottom: 32px; }

/* NOTE: Do not redefine .hidden - it conflicts with Tailwind responsive classes */
.on-hidden { display: none; }
.on-visible { visibility: visible; }
.on-invisible { visibility: hidden; }

.on-flex { display: flex; }
.on-flex-center { display: flex; align-items: center; justify-content: center; }
.on-flex-between { display: flex; align-items: center; justify-content: space-between; }

.on-gap-1 { gap: 8px; }
.on-gap-2 { gap: 16px; }
.on-gap-3 { gap: 24px; }

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    :root {
        --header-height: 64px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .notes-grid {
        grid-template-columns: 1fr;
    }
    
    .app-nav {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .header-container {
        padding: 0 16px;
    }
    
    .main-content {
        padding: 24px 16px;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 48px 16px;
    }
    
    .hero-actions {
        flex-direction: column;
    }
    
    .hero-actions .btn {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== MATERIAL ICONS ==================== */

.material-symbols-rounded {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ==================== ANIMATIONS ==================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s var(--ease-smooth) forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.4s var(--ease) forwards;
}

/* ==================== ACCESS MODAL (old styles compatibility) ==================== */

.access-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: all var(--speed) var(--ease-smooth);
}

.access-modal.show {
    opacity: 1;
    visibility: visible;
}

.access-modal-content {
    background: white;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--speed-slow) var(--ease);
}

.access-modal.show .access-modal-content {
    transform: scale(1) translateY(0);
}

.access-modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.access-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.access-modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--speed) var(--ease-smooth);
    background: none;
    border: none;
    font-size: 1.5rem;
}

.access-modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.access-modal-body {
    padding: 24px;
}

.access-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==================== TABS ==================== */

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: all var(--speed) var(--ease-smooth);
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    background: white;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

/* ==================== CODE BLOCKS ==================== */

code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.85em;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
}

pre {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
}

pre code {
    background: none;
    padding: 0;
}

/* ==================== ANALYTICS SPECIFIC ==================== */

.analytics-section {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.analytics-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.analytics-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.chart-container {
    position: relative;
    height: 300px;
}

/* ==================== NOTES BROWSER SPECIFIC ==================== */

.browser-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.view-toggle {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.view-toggle button {
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: all var(--speed) var(--ease-smooth);
}

.view-toggle button.active {
    background: white;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.sort-select {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
}

/* ==================== API STATUS ==================== */

.api-status-banner {
    background: var(--bg);
    color: var(--text-secondary);
    padding: 12px 24px;
    text-align: center;
    display: none;
    font-size: 0.9rem;
}

.api-status-banner.show {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.api-status-banner a {
    color: var(--accent);
    font-weight: 500;
}

/* ==================== PAGINATION ==================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--speed) var(--ease-smooth);
}

.pagination button:hover {
    border-color: var(--text);
    color: var(--text);
}

.pagination button.active {
    background: var(--text);
    color: white;
    border-color: var(--text);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* ==================== NOTES BROWSER COMPONENT ==================== */

.notes-browser {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.notes-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-input,
.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: white;
    color: var(--text);
    transition: border-color 0.2s ease;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-checkbox {
    flex-direction: row;
    align-items: center;
}

.filter-checkbox label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    text-transform: none;
}

.btn-clear-filters {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-end;
}

.btn-clear-filters:hover {
    border-color: var(--text);
    color: var(--text);
}

.notes-sorting {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.notes-sorting label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: white;
    color: var(--text);
    cursor: pointer;
}

.notes-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.view-toggle {
    display: flex;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.view-toggle .btn-view {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-toggle .btn-view:hover {
    background: var(--bg);
    color: var(--text);
}

.view-toggle .btn-view.active {
    background: var(--accent);
    color: white;
}

.notes-container {
    padding: 20px;
    min-height: 300px;
}

.notes-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.notes-container.list-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notes-container.list-view .note-card {
    flex-direction: row;
    align-items: center;
}

.notes-loading,
.notes-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    text-align: center;
    color: var(--text-secondary);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-retry {
    margin-top: 16px;
    padding: 8px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-retry:hover {
    background: var(--accent-hover);
}

.notes-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.btn-page {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-page:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.notes-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.count-value {
    font-weight: 600;
    color: var(--text);
}

/* Note Card Enhancements */
.note-card .badge {
    position: absolute;
    top: 8px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    color: white;
}

.note-card .badge.verified {
    right: 8px;
    background: var(--gold);
}

.note-card .badge.ai {
    left: 8px;
    background: #8b5cf6;
}

.note-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.note-actions button,
.note-actions a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.note-actions button:hover,
.note-actions a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-favorite.active {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

.note-updated {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ==================== ANALYTICS DASHBOARD COMPONENT ==================== */

.analytics-dashboard {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.analytics-dashboard .analytics-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.analytics-dashboard .analytics-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.analytics-actions {
    display: flex;
    gap: 8px;
}

.btn-refresh,
.btn-export {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-refresh:hover,
.btn-export:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.analytics-loading,
.analytics-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    text-align: center;
    color: var(--text-secondary);
}

.analytics-content {
    padding: 20px;
}

.analytics-content .stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.analytics-content .stat-card {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
}

.analytics-content .stat-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.analytics-content .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.analytics-content .stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.analytics-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.chart-container {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 20px;
}

.chart-container h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.chart-area {
    min-height: 200px;
}

.analytics-tables {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.table-container {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 20px;
    overflow: hidden;
}

.table-container h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
}

.analytics-table th,
.analytics-table td {
    padding: 10px 12px;
    text-align: left;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.analytics-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: white;
}

.analytics-table td {
    color: var(--text);
}

.analytics-table tr:last-child td {
    border-bottom: none;
}

/* Bar Chart Styles */
.chart-bar-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-bar-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-width: 80px;
}

.chart-bar-track {
    flex: 1;
    height: 24px;
    background: white;
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-xs);
    transition: width 0.5s ease;
}

.chart-bar-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    min-width: 40px;
    text-align: right;
}