/**
 * Admin Dashboard Theme - Modern Admindek-style
 * 
 * Design inspiration and UI patterns taken from:
 * https://demo.dashboardpack.com/admindek-html/dashboard/index.html
 * (Admindek Dashboard Template by DashboardPack)
 * 
 * This includes: sidebar navigation, header layout, stat cards, 
 * data tables, form components, responsive design patterns, and color schemes.
 */

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

:root {
    /* Primary Colors */
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --primary-bg: rgba(79, 70, 229, 0.1);
    
    /* Accent Colors */
    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3B82F6;
    --info-bg: rgba(59, 130, 246, 0.1);
    
    /* Neutral Colors */
    --sidebar-bg: #1E293B;
    --sidebar-hover: #334155;
    --sidebar-active: #4F46E5;
    --sidebar-text: #94A3B8;
    --sidebar-text-active: #FFFFFF;
    
    --header-bg: #FFFFFF;
    --content-bg: #F1F5F9;
    --card-bg: #FFFFFF;
    
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    
    --border-color: #E2E8F0;
    --border-light: #F1F5F9;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Dimensions */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 70px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --sidebar-bg: #0F172A;
    --sidebar-hover: #1E293B;
    
    --header-bg: #1E293B;
    --content-bg: #0F172A;
    --card-bg: #1E293B;
    
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --border-color: #334155;
    --border-light: #1E293B;
}

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

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    min-width: 0;
}

/* ========== LAYOUT WRAPPER ========== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ========== SIDEBAR ========== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width var(--transition-normal), transform var(--transition-normal);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: var(--header-height);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo svg {
    width: 24px;
    height: 24px;
    color: white;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition-normal);
}

.sidebar.collapsed .sidebar-brand {
    opacity: 0;
    width: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sidebar-text);
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-section-title {
    text-align: center;
    padding: 0.5rem;
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.nav-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-link-text {
    opacity: 1;
    transition: opacity var(--transition-normal);
}

.sidebar.collapsed .nav-link-text {
    opacity: 0;
    width: 0;
}

.nav-badge {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--danger);
    color: white;
    border-radius: 9999px;
    transition: opacity var(--transition-normal);
}

.sidebar.collapsed .nav-badge {
    opacity: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.sidebar-user:hover {
    background: var(--sidebar-hover);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--success) 0%, var(--info) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.user-info {
    overflow: hidden;
    transition: opacity var(--transition-normal), width var(--transition-normal);
}

.sidebar.collapsed .user-info {
    opacity: 0;
    width: 0;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    transition: margin-left var(--transition-normal);
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* ========== HEADER ========== */
.admin-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 900;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.sidebar-toggle svg {
    width: 24px;
    height: 24px;
}

.header-search {
    position: relative;
}

.header-search input {
    width: 300px;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background: var(--content-bg);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

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

.header-search svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    position: relative;
    transition: all var(--transition-fast);
}

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

.header-btn svg {
    width: 22px;
    height: 22px;
}

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

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem;
    background: var(--border-light);
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
}

.theme-toggle-option {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.theme-toggle-option.active {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.theme-toggle-option svg {
    width: 18px;
    height: 18px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0.75rem 0.375rem 0.375rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.header-user:hover {
    background: var(--border-light);
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
}

.header-user-info {
    text-align: left;
}

.header-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== PAGE CONTENT ========== */
.page-content {
    flex: 1;
    padding: 1.5rem;
    min-width: 0;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb a:hover {
    color: var(--primary);
}

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

.page-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

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

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

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

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

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--border-light);
    border-color: var(--primary);
    color: var(--primary);
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #DC2626;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

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

/* ========== DASHBOARD LAYOUT ========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.dashboard-main,
.dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

/* ========== STAT CARDS ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

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

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

.stat-card.clickable {
    cursor: pointer;
}

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

.stat-icon svg {
    width: 26px;
    height: 26px;
}

.stat-icon.primary {
    background: var(--primary-bg);
    color: var(--primary);
}

.stat-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-icon.info {
    background: var(--info-bg);
    color: var(--info);
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

.stat-trend.up {
    background: var(--success-bg);
    color: var(--success);
}

.stat-trend.down {
    background: var(--danger-bg);
    color: var(--danger);
}

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

/* ========== CARDS ========== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
    min-width: 0;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
    min-width: 0;
    overflow-x: auto;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--border-light);
}

/* ========== DATA TABLE ========== */
.data-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.data-table thead {
    background: var(--border-light);
}

.data-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-primary);
}

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

.data-table tbody tr:hover {
    background: var(--border-light);
}

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

/* Table Cell Variants */
.cell-primary {
    font-weight: 600;
    color: var(--text-primary);
}

.cell-secondary {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.cell-mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* ========== BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    white-space: nowrap;
}

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

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

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

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

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

.badge-muted {
    background: var(--border-light);
    color: var(--text-muted);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

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

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.chart-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* ========== MODALS ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

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

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

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

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

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

/* ========== ALERTS ========== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-message {
    font-size: 0.875rem;
    opacity: 0.9;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-warning {
    background: var(--warning-bg);
    color: #92400E;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ========== PROGRESS ========== */
.progress-bar {
    height: 8px;
    background: var(--border-light);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.5s ease;
}

.progress-fill.primary {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
}

.progress-fill.success {
    background: linear-gradient(90deg, var(--success) 0%, #34D399 100%);
}

.progress-fill.danger {
    background: linear-gradient(90deg, var(--danger) 0%, #F87171 100%);
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ========== LOADING ========== */
.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

[data-theme="dark"] .loading-overlay {
    background: rgba(15, 23, 42, 0.8);
}

/* ========== SUBSCRIPTION CARD ========== */
.subscription-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.subscription-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}

.subscription-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    position: relative;
}

.subscription-plan {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.subscription-name {
    font-size: 1.5rem;
    font-weight: 700;
}

.subscription-status {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.subscription-usage {
    margin-bottom: 1.5rem;
    position: relative;
}

.usage-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.usage-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: white;
    border-radius: 9999px;
    transition: width 0.5s ease;
}

.subscription-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    opacity: 0.9;
    position: relative;
}

/* ========== API KEY DISPLAY ========== */
.api-key-box {
    background: var(--border-light);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.875rem;
    word-break: break-all;
    margin: 1rem 0;
}

/* ========== DROPDOWN ========== */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 200px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--border-light);
}

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

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

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar.collapsed ~ .main-content {
        margin-left: 0;
    }
    
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }
    
    .mobile-overlay.show {
        display: block;
    }
    
    .header-search {
        display: none;
    }
    
    .admin-header {
        padding: 0 1rem;
    }
    
    .sidebar-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }
    
    .admin-header {
        padding: 0 0.75rem;
    }
    
    .header-left {
        gap: 0.5rem;
    }
    
    .sidebar-toggle {
        width: 36px;
        height: 36px;
    }
    
    .page-content {
        padding: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .breadcrumb {
        font-size: 0.75rem;
    }
    
    .page-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .page-actions .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-sidebar {
        order: -1;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 0.875rem;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        text-align: center;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    
    .stat-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .stat-content {
        flex: 1;
        text-align: center;
        min-width: 0;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .stat-change {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
    
    .card {
        border-radius: var(--radius-md);
    }
    
    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .header-user-info {
        display: none;
    }
    
    .header-right {
        gap: 0.5rem;
    }
    
    .header-btn {
        width: 36px;
        height: 36px;
        padding: 0;
    }
    
    .header-user {
        padding: 0.25rem;
    }
    
    .header-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    .dropdown-menu {
        right: 0;
        min-width: 220px;
    }
    
    /* Theme toggle smaller on mobile */
    .theme-toggle {
        padding: 2px;
    }
    
    .theme-toggle-option {
        padding: 0.35rem;
    }
    
    .theme-toggle-option svg {
        width: 14px;
        height: 14px;
    }
    
    /* Mobile-friendly tables */
    .data-table-wrapper {
        margin: 0;
        border-radius: 0;
    }
    
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th {
        white-space: nowrap;
        padding: 0.75rem 0.5rem;
    }
    
    .data-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .data-table th:first-child,
    .data-table td:first-child {
        padding-left: 1rem;
    }
    
    .data-table th:last-child,
    .data-table td:last-child {
        padding-right: 1rem;
    }
    
    /* Hide non-essential columns on mobile */
    .data-table .hide-mobile {
        display: none;
    }
    
    /* Alerts */
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .alert svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr !important;
    }
    
    /* Buttons */
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.35rem 0.625rem;
        font-size: 0.75rem;
    }
    
    /* Badge */
    .badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }
    
    /* Charts */
    .chart-container {
        min-height: 200px;
    }
    
    /* Empty state */
    .empty-state {
        padding: 2rem 1rem;
    }
    
    .empty-state-icon {
        width: 60px;
        height: 60px;
    }
    
    .empty-state-icon svg {
        width: 30px;
        height: 30px;
    }
    
    .empty-state-title {
        font-size: 1rem;
    }
    
    .empty-state-description {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    :root {
        --header-height: 56px;
    }
    
    .admin-header {
        padding: 0 0.5rem;
    }
    
    .sidebar-toggle {
        width: 32px;
        height: 32px;
    }
    
    .sidebar-toggle svg {
        width: 20px;
        height: 20px;
    }
    
    .page-content {
        padding: 0.75rem;
    }
    
    .page-header {
        margin-bottom: 1rem;
    }
    
    .page-title {
        font-size: 1.125rem;
    }
    
    .stats-grid {
        gap: 0.5rem;
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card {
        padding: 0.875rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
    }
    
    .stat-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .stat-content {
        text-align: center;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-change {
        position: static;
        margin-top: 0.25rem;
    }
    
    .card-header,
    .card-body {
        padding: 0.875rem;
    }
    
    .header-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    
    .theme-toggle {
        padding: 2px;
        gap: 0;
    }
    
    .theme-toggle-option {
        padding: 0.3rem;
    }
    
    .theme-toggle-option svg {
        width: 12px;
        height: 12px;
    }
    
    /* Hide some columns on very small screens */
    .data-table .hide-mobile {
        display: none;
    }
    
    /* Action buttons stack */
    .data-table td:last-child > div {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .btn-sm {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }
    
    /* Quick actions */
    .quick-actions {
        gap: 0.5rem;
    }
    
    .quick-action-item {
        padding: 0.75rem;
        font-size: 0.8rem;
    }
    
    .quick-action-item svg {
        width: 18px;
        height: 18px;
    }
    
    /* Modals */
    .modal-content {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-title {
        font-size: 1rem;
    }
    
    /* Breadcrumb - hide on very small screens */
    .breadcrumb {
        display: none;
    }
}

/* ========== UTILITIES ========== */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary { background: var(--primary-bg) !important; }
.bg-success { background: var(--success-bg) !important; }
.bg-warning { background: var(--warning-bg) !important; }
.bg-danger { background: var(--danger-bg) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mb-4 { margin-bottom: 2rem !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.5rem !important; }
.p-2 { padding: 1rem !important; }
.p-3 { padding: 1.5rem !important; }
.p-4 { padding: 2rem !important; }

.flex { display: flex !important; }
.flex-wrap { flex-wrap: wrap !important; }
.items-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-1 { gap: 0.5rem !important; }
.gap-2 { gap: 1rem !important; }
.gap-3 { gap: 1.5rem !important; }

.w-full { width: 100% !important; }
.hidden { display: none !important; }
.visible { display: block !important; }
