/* Lil Assistance Dashboard - AltText Style */

/* CSS Variables */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --accent: #f59e0b; /* Lil Assistance brand color */
    --accent-hover: #d97706;
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --error: #ef4444;
    --error-bg: #fee2e2;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --card-bg: var(--bg-elevated);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-elevated: #334155;
    --bg-tertiary: #475569;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #475569;
    --accent: #f59e0b;
    --accent-hover: #fbbf24;
    --success: #34d399;
    --success-bg: #064e3b;
    --warning: #fbbf24;
    --warning-bg: #78350f;
    --danger: #f87171;
    --error: #f87171;
    --error-bg: #7f1d1d;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --card-bg: var(--bg-elevated);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
    padding-top: 64px;
}

/* Layout */
.dashboard-layout {
    display: flex;
    min-height: calc(100vh - 64px);
    background: var(--bg-primary);
}

.dashboard-content {
    flex: 1;
    min-width: 0;
    padding: 2rem;
    background: var(--bg-primary);
    overflow-y: auto;
    height: calc(100vh - 64px);
    position: fixed;
    top: 64px;
    right: 0;
    left: 260px;
    width: calc(100% - 260px);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Icons */
.icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

.icon-lg {
    width: 24px;
    height: 24px;
}

/* Navigation Bar */
.navbar {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 3rem;
}

@media (max-width: 767px) {
    .nav-left {
        gap: 1rem;
    }
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
    text-decoration: none;
}

.logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
}

/* Sidebar */
.dashboard-sidebar {
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    flex: 0 0 260px;
    width: 260px;
    height: calc(100vh - 64px);
    position: fixed;
    top: 64px;
    left: 0;
    z-index: 30;
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Custom scrollbar for sidebar - inside the sidebar */
.dashboard-sidebar::-webkit-scrollbar {
    width: 8px;
}

.dashboard-sidebar::-webkit-scrollbar-track {
    background: var(--bg-elevated);
    margin: 4px 0;
}

.dashboard-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    border: 2px solid var(--bg-elevated);
}

.dashboard-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.sidebar-content {
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.sidebar-scroll {
    flex: 1;
    margin-top: 1rem;
    padding-right: 1rem;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    gap: 2rem;
}

.sidebar-brand {
    display: none;
}

.sidebar-section {
    padding: 0 0.75rem;
}

.sidebar-section + .sidebar-section {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.sidebar-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    color: var(--text-secondary);
    transition: background-color 0.2s ease, color 0.2s ease;
    border: 1px solid transparent;
}

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

.sidebar-link.is-active {
    background: var(--bg-secondary);
    color: var(--accent);
    border-color: var(--border);
}

.sidebar-link-label {
    flex: 1;
    min-width: 0;
}

.sidebar-link-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    background: var(--warning-bg);
    color: var(--warning);
    white-space: nowrap;
}

.sidebar-link-badge.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

/* Desktop - Always show sidebar */
@media (min-width: 961px) {
    .dashboard-sidebar {
        display: flex !important;
        transform: none !important;
    }
}

/* Custom scrollbar for dashboard content - inside the content area */
.dashboard-content {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg-primary);
}

.dashboard-content::-webkit-scrollbar {
    width: 10px;
}

.dashboard-content::-webkit-scrollbar-track {
    background: var(--bg-primary);
    margin: 4px 0;
}

.dashboard-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
    border: 2px solid var(--bg-primary);
}

.dashboard-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Mobile and Tablet - Collapsible sidebar */
@media (max-width: 960px) {
    body {
        padding-top: 64px;
    }

    .dashboard-layout {
        flex-direction: column;
        min-height: auto;
    }

    .dashboard-sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: calc(100vh - 64px);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
        box-shadow: var(--shadow-lg);
    }

    body.sidebar-open .dashboard-sidebar {
        transform: translateX(0);
    }

    .sidebar-inner {
        padding: 1rem;
        gap: 1.5rem;
    }

    .sidebar-section {
        padding: 0 0.5rem;
    }

    .dashboard-content {
        margin-left: 0;
        left: 0;
        right: 0;
        position: relative;
        height: auto;
        min-height: calc(100vh - 64px);
        overflow-y: visible;
        width: 100%;
        padding: 1rem;
    }

    .container {
        padding: 0 16px;
    }

    .nav-container {
        padding: 0 16px;
    }

    /* Make stats grid single column on mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 32px;
    }

    /* Adjust card padding */
    .stat-card,
    .action-card,
    .feature-section,
    .dashboard-card {
        padding: 16px;
        margin-bottom: 16px;
    }

    /* Smaller headers on mobile */
    .dashboard-header h1 {
        font-size: 24px;
    }

    .dashboard-header p {
        font-size: 14px;
    }

    /* Adjust footer */
    .dashboard-footer {
        padding: 1rem 0;
        margin-top: 2rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Hide logo text on very small screens */
    .logo-text {
        display: none;
    }

    /* Hide credits badge and theme toggle on mobile */
    .nav-right .credits-badge,
    .nav-right .theme-toggle {
        display: none !important;
    }

    .credits-detail {
        display: none;
    }

    /* Show user dropdown */
    .user-menu {
        display: flex;
    }

    /* Make logo bigger on mobile */
    .logo-img {
        height: 40px;
    }
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 0.625rem 1.5rem;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.nav-link.active {
    color: var(--accent);
    background: var(--bg-secondary);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
}

.nav-separator {
    height: 1px;
    background: var(--border);
    margin: 1rem 1.5rem;
}

/* Credits Badge */
.credits-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

.nav-badge,
.nav-credit {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.nav-badge {
    background: var(--success-bg);
    color: var(--success);
}

.nav-credit {
    background: var(--warning-bg);
    color: var(--warning);
}

/* Theme Toggle */
.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: var(--text-secondary);
}

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

/* Dropdown menu */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 1000;
    overflow: hidden;
}

.user-menu.active .user-dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

.dropdown-credits {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.dropdown-credits-label {
    font-size: 12px;
    color: var(--text-muted);
}

.dropdown-credits-amount {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

/* Hero Section */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.dashboard-header p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 48px;
}

.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 24px;
    transition: all 0.2s ease;
}

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

.stat-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.stat-content h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-content p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Cards */
.action-card,
.feature-section,
.dashboard-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 24px;
    margin-bottom: 24px;
    transition: all 0.2s ease;
}

.action-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

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

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

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

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

/* Activity List */
.activity-list {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.activity-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background: var(--bg-secondary);
}

/* Flash Messages */
.flash-message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

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

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

/* Footer */
.dashboard-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 0.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

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

/* Modal Styles */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: none !important;
    z-index: 10000 !important;
    overflow-y: auto !important;
}

.modal-overlay.active {
    display: block !important;
}

.modal-overlay .modal {
    background: var(--bg-primary) !important;
    border-radius: 5px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    max-width: 650px !important;
    width: 90% !important;
    max-height: 90vh !important;
    overflow: hidden !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(0.9) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 10001 !important;
    border: 1px solid var(--border) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
}

.modal-overlay.active .modal {
    transform: translate(-50%, -50%) scale(1) !important;
}

[data-theme="dark"] .modal-overlay .modal {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3) !important;
}

@media (max-width: 768px) {
    .modal-overlay {
        padding: 0.5rem !important;
    }

    .modal-overlay .modal {
        max-width: 95% !important;
        max-height: 95vh !important;
    }
}

.modal-header {
    padding: 1.75rem 2rem !important;
    border-bottom: 1px solid var(--border) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: var(--bg-elevated) !important;
    flex-shrink: 0 !important;
    gap: 1.5rem !important;
    min-height: 68px !important;
}

.modal-title {
    font-size: 20px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    margin: 0 !important;
    letter-spacing: -0.025em !important;
    flex: 1 !important;
    line-height: 1.4 !important;
}

.modal-close {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    cursor: pointer !important;
    padding: 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
    width: 32px !important;
    height: 32px !important;
    flex-shrink: 0 !important;
}

.modal-close:hover {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--text-secondary) !important;
}

.modal-body {
    padding: 2rem !important;
    overflow-y: auto !important;
    max-height: calc(90vh - 180px) !important;
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1.25rem !important;
}

.modal-body .form-group {
    margin-bottom: 0 !important;
}

.modal-body .form-group:last-child {
    margin-bottom: 0 !important;
}

.modal-footer {
    padding: 1.5rem 2rem !important;
    border-top: 1px solid var(--border) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 1rem !important;
    background: var(--bg-secondary) !important;
    flex-shrink: 0 !important;
    min-height: 68px !important;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 2rem;
}

.chart-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.chart-tab {
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -2px;
}

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

.chart-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
