/* ============================================================
   Dijital Analiz — Premium Design System
   Stripe / Linear / Notion inspired premium UI
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS Custom Properties (Design Tokens)
   ============================================================ */
:root {
    /* Primary */
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-lighter: #93bbfd;
    --primary-lightest: #dbeafe;
    --primary-dark: #1e3a8a;
    --primary-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);

    /* Backgrounds */
    --bg-body: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f8fafc;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: rgba(59, 130, 246, 0.15);

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #ffffff;

    /* Status Colors */
    --success: #059669;
    --success-light: #d1fae5;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --danger-bg: #fef2f2;
    --info: #0284c7;
    --info-light: #e0f2fe;
    --info-bg: #f0f9ff;

    /* Borders */
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --border-focus: #3b82f6;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-card-hover: 0 10px 25px -5px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-dropdown: 0 10px 40px rgba(0, 0, 0, 0.12);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.0625rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    font-size: var(--text-base);
    color: var(--text-primary);
    background: var(--bg-body);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary); }

img { max-width: 100%; height: auto; }

/* ============================================================
   Layout — App Shell
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition-slow);
}

.app-content {
    flex: 1;
    padding: var(--space-8);
    padding-top: calc(var(--topbar-height) + var(--space-8));
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition-slow);
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-brand {
    padding: var(--space-6) var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    min-height: var(--topbar-height);
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.sidebar-brand-text {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-white);
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.sidebar-brand-text span {
    color: var(--primary-light);
}

.sidebar-section {
    padding: var(--space-4) var(--space-3);
}

.sidebar-section-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: rgba(148, 163, 184, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 var(--space-3);
    margin-bottom: var(--space-2);
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-sidebar);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    position: relative;
}

.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-white);
}

.sidebar-link.active {
    background: var(--bg-sidebar-active);
    color: var(--primary-light);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary-light);
    border-radius: 0 3px 3px 0;
}

.sidebar-link svg,
.sidebar-link .sidebar-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active svg,
.sidebar-link.active .sidebar-icon {
    opacity: 1;
}

.sidebar-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-8);
    z-index: 900;
    transition: var(--transition-slow);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.topbar-breadcrumb a { color: var(--text-muted); }
.topbar-breadcrumb a:hover { color: var(--text-primary); }
.topbar-breadcrumb .current { color: var(--text-primary); font-weight: 600; }

.topbar-search {
    position: relative;
    width: 320px;
}

.topbar-search input {
    width: 100%;
    padding: var(--space-2) var(--space-4);
    padding-left: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: var(--transition);
    font-family: var(--font);
    height: 38px;
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.topbar-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.topbar-icon-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.topbar-icon-btn:hover {
    border-color: var(--border-focus);
    color: var(--primary);
    background: var(--primary-lightest);
}

.topbar-icon-btn svg { width: 18px; height: 18px; }

.topbar-icon-btn .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-surface);
    position: relative;
}

.topbar-user:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-sm);
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
}

.topbar-user-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.topbar-user-role {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
}

/* User dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dropdown);
    min-width: 200px;
    padding: var(--space-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: var(--transition);
    z-index: 1000;
}

.topbar-user:hover .user-dropdown,
.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    transition: var(--transition);
}

.user-dropdown a:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.user-dropdown a svg { width: 16px; height: 16px; flex-shrink: 0; }
.user-dropdown-divider { height: 1px; background: var(--border); margin: var(--space-2) 0; }

.user-dropdown a.danger { color: var(--danger); }
.user-dropdown a.danger:hover { background: var(--danger-bg); }

/* ============================================================
   Notification Dropdown
   ============================================================ */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dropdown);
    width: 380px;
    max-height: 480px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: var(--transition);
    z-index: 1000;
}

.notification-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

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

.notification-header h4 { font-size: var(--text-sm); font-weight: 600; }
.notification-header a { font-size: var(--text-xs); color: var(--primary-light); }

.notification-list {
    max-height: 380px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
    cursor: pointer;
}

.notification-item:hover { background: var(--bg-surface-hover); }
.notification-item.unread { background: var(--info-bg); }

.notification-item-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.notification-item-icon.alert { background: var(--danger-light); color: var(--danger); }
.notification-item-icon.info { background: var(--info-light); color: var(--info); }
.notification-item-icon.success { background: var(--success-light); color: var(--success); }
.notification-item-icon.warning { background: var(--warning-light); color: var(--warning); }

.notification-item-content { flex: 1; min-width: 0; }
.notification-item-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.notification-item-text { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 2px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notification-item-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    overflow: hidden;
}

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

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

.card-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.card-title svg { width: 18px; height: 18px; color: var(--text-muted); }

.card-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.card-body {
    padding: var(--space-6);
}

.card-body.no-padding { padding: 0; }

/* ============================================================
   Stat Cards
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-color, var(--primary));
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover::after { opacity: 1; }

.stat-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-icon svg { width: 22px; height: 22px; }
.stat-card-icon.blue { background: var(--primary-lightest); color: var(--primary); }
.stat-card-icon.green { background: var(--success-light); color: var(--success); }
.stat-card-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-card-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-card-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-card-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.stat-card-change.up { background: var(--success-bg); color: var(--success); }
.stat-card-change.down { background: var(--danger-bg); color: var(--danger); }

.stat-card-value {
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-1);
}

.stat-card-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================================
   Charts Grid
   ============================================================ */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.charts-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

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

/* ============================================================
   Tables
   ============================================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--text-sm);
}

.data-table thead th {
    background: var(--bg-surface-hover);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tbody td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-surface-hover);
}

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

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-primary { background: var(--primary-lightest); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-critical { background: #fde8e8; color: #991b1b; }

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-dot.active { background: var(--success); }
.badge-dot.inactive { background: var(--text-muted); }
.badge-dot.error { background: var(--danger); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.5;
    height: 38px;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 1px 2px rgba(30, 64, 175, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.4);
    transform: translateY(-1px);
    color: white;
}

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

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

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

.btn-danger:hover {
    background: #b91c1c;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: var(--space-2) var(--space-3);
}

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

.btn-sm {
    height: 32px;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    height: 44px;
    padding: var(--space-3) var(--space-8);
    font-size: var(--text-base);
}

.btn-icon {
    width: 38px;
    padding: 0;
}

.btn-icon.btn-sm { width: 32px; }

/* ============================================================
   Forms
   ============================================================ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-surface);
    transition: var(--transition);
    height: 40px;
}

.form-textarea {
    height: auto;
    min-height: 100px;
    resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.form-input-icon {
    position: relative;
}

.form-input-icon .form-input {
    padding-left: 40px;
}

.form-input-icon svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
}

.form-row-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-light);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Checkbox */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    font-size: var(--text-sm);
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    appearance: none;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.form-checkbox input[type="checkbox"]:checked {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.form-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* ============================================================
   Filter Panel
   ============================================================ */
.filter-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
}

.filter-row {
    display: flex;
    align-items: flex-end;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.filter-row .form-group {
    margin-bottom: 0;
    min-width: 160px;
    flex: 1;
}

.filter-row .btn {
    flex-shrink: 0;
}

/* ============================================================
   Mention Cards
   ============================================================ */
.mention-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    transition: var(--transition);
    position: relative;
}

.mention-card:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: var(--primary-lighter);
}

.mention-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.mention-platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.mention-author {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.mention-author-name { font-weight: 600; color: var(--text-primary); }
.mention-author-handle { color: var(--text-muted); }

.mention-card-time {
    margin-left: auto;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.mention-card-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    line-height: 1.4;
}

.mention-card-content {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-4);
}

.mention-card-content .keyword-highlight {
    background: #fef9c3;
    color: #854d0e;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.mention-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.mention-stats {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.mention-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.mention-stat svg { width: 14px; height: 14px; }

.mention-keywords {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.mention-keyword-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    background: var(--primary-lightest);
    color: var(--primary);
    border: 1px solid var(--primary-lighter);
}

.mention-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ============================================================
   Platform Cards
   ============================================================ */
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-6);
}

.platform-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.platform-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.platform-card-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.platform-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}

.platform-card-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.platform-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.platform-card-icon svg,
.platform-card-icon .platform-icon {
    width: 24px;
    height: 24px;
}

.platform-card-name {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.platform-card-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
}

.platform-stat-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: 2px;
}

.platform-stat-value {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-8);
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.pagination a:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: var(--primary-lightest);
}

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

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-5);
    background: var(--bg-body);
    border-radius: var(--radius-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon svg {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-text {
    font-size: var(--text-sm);
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto var(--space-5);
}

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.page-header-left {
    display: flex;
    flex-direction: column;
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ============================================================
   Flash Messages
   ============================================================ */
.flash-message {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
    font-size: var(--text-sm);
    font-weight: 500;
    animation: slideDown 0.3s ease;
    position: relative;
}

.flash-message.success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-light);
}

.flash-message.error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-light);
}

.flash-message.info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid var(--info-light);
}

.flash-close {
    margin-left: auto;
    cursor: pointer;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.6;
    font-size: 18px;
}

.flash-close:hover { opacity: 1; }

/* ============================================================
   Platform Icons (inline SVG styling)
   ============================================================ */
.platform-icon { width: 18px; height: 18px; display: inline-block; }
.platform-twitter { color: #1DA1F2; }
.platform-instagram { color: #E4405F; }
.platform-facebook { color: #1877F2; }
.platform-news { color: var(--primary); }
.platform-rss { color: #f97316; }

/* ============================================================
   Keyword color dot
   ============================================================ */
.color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ============================================================
   View Toggle
   ============================================================ */
.view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.view-toggle button {
    padding: var(--space-2) var(--space-3);
    background: var(--bg-surface);
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.view-toggle button.active {
    background: var(--primary-lightest);
    color: var(--primary);
}

.view-toggle button:not(:last-child) {
    border-right: 1px solid var(--border);
}

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-6);
}

.tab-link {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
}

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

.tab-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* ============================================================
   Skeleton Loading
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 12px; }
.skeleton-card { height: 120px; border-radius: var(--radius-lg); }

/* ============================================================
   Animations
   ============================================================ */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.animate-fade { animation: fadeIn 0.3s ease; }
.animate-scale { animation: scaleIn 0.2s ease; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
    .charts-grid-3 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .topbar {
        left: 0;
    }
    .app-content {
        padding: var(--space-4);
        padding-top: calc(var(--topbar-height) + var(--space-4));
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }
    .filter-row {
        flex-direction: column;
    }
    .filter-row .form-group {
        min-width: 100%;
    }
    .topbar-search { display: none; }
    .platform-grid {
        grid-template-columns: 1fr;
    }
}

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

/* ============================================================
   Utility Classes
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary) !important; }
.text-sm { font-size: var(--text-sm) !important; }
.text-xs { font-size: var(--text-xs) !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mr-2 { margin-right: var(--space-2); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* Color input */
input[type="color"] {
    -webkit-appearance: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    cursor: pointer;
    padding: 2px;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
