:root {
    /* Light Mode Color Palette */
    --primary: #4F46E5; /* Indigo */
    --primary-hover: #4338CA;
    --secondary: #10B981; /* Emerald */
    --bg-main: #f3f4f6; /* Gray 100 */
    --surface: #ffffff; /* White */
    --surface-border: #e5e7eb; /* Gray 200 */
    --text-main: #1f2937; /* Gray 800 */
    --text-muted: #6b7280; /* Gray 500 */
    
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism / Surface Utilities */
.glass {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: all 0.3s ease;
}

.brand {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    font-weight: 500;
    gap: 1rem;
}

.nav-item:hover, .nav-item.active {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}
.nav-item.active {
    border-left: 4px solid var(--primary);
    border-radius: 0 0.75rem 0.75rem 0;
}

.nav-item i {
    font-size: 1.2rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: calc(100% - 280px);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: white;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
    border-radius: 1rem;
    color: white;
    border: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card-purple {
    background: linear-gradient(135deg, #6366f1, #a855f7);
}
.card-green {
    background: linear-gradient(135deg, #10b981, #059669);
}
.card-blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    z-index: 1;
}

.stat-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 6rem;
    color: rgba(255, 255, 255, 0.15);
    z-index: 0;
}

/* Tables */
.table-container {
    padding: 1.5rem;
    overflow-x: auto;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-title {
    font-size: 1.2rem;
    font-weight: 600;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--surface-border);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    background: #f9fafb;
}

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

tr:hover td {
    background: #f9fafb;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.success { background: #d1fae5; color: var(--success); }
.badge.pending { background: #fef3c7; color: var(--warning); }
.badge.failed { background: #fee2e2; color: var(--danger); }

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--surface-border);
}
.btn-outline:hover {
    background: var(--bg-main);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
}

/* Form Elements General */
.form-group {
    margin-bottom: 1.2rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}
.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--surface-border);
    border-radius: 0.5rem;
    font-size: 1rem;
    background: transparent;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.3s;
}
.form-control:focus {
    border-color: var(--primary);
}
select.form-control {
    background: var(--surface);
    cursor: pointer;
}

/* API Key Box */
.api-key-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--surface-border);
    margin-bottom: 1rem;
}

.api-key-box input {
    background: transparent;
    border: none;
    color: var(--text-main);
    flex: 1;
    font-family: monospace;
    font-size: 1rem;
    outline: none;
}

/* Responsive */
@media (max-width: 768px) {
    body { font-size: 0.9rem; }
    .page-title { font-size: 1.1rem; }
    .stat-value { font-size: 1.5rem; }
    .stat-title { font-size: 0.75rem; }
    .stat-card { padding: 1rem; }
    .table-title { font-size: 1rem; }
    th, td { padding: 0.75rem 0.5rem; font-size: 0.85rem; }
    
    .mobile-menu-btn {
        display: block;
    }
    .sidebar {
        transform: translateX(-100%);
        width: 250px;
        box-shadow: 10px 0 15px -3px rgba(0, 0, 0, 0.1);
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 0.8rem;
        width: 100%;
    }
    .header {
        flex-direction: row; 
        align-items: center;
        gap: 0.5rem;
        padding: 0.8rem 1rem;
    }
    .user-name {
        display: none; 
    }
}
