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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --danger-color: #ef4444;
    --success-color: #10b981;
}

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

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

/* Auth Container */
.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.5s ease-out forwards;
}

/* Dashboard overrides for full-width panels */
.dashboard-content .glass-panel {
    max-width: 100%;
}

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

.glass-panel h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
    background: linear-gradient(to right, #818cf8, #c084fc);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glass-panel p {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.filter-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* Select Multiple styling */
select[multiple].form-control {
    padding: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) rgba(0, 0, 0, 0.2);
}

select[multiple].form-control option {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 2px;
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.1);
}

select[multiple].form-control option:checked {
    background: var(--primary-color);
    color: white;
}

select[multiple].form-control option:hover {
    background: rgba(79, 70, 229, 0.3);
}

.btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: none;
}

.alert.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    display: block;
}

.alert.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
    display: block;
}

/* Spinner for button */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    display: none;
    margin-left: 0.5rem;
}

.btn.loading .text { display: none; }
.btn.loading .spinner { display: inline-block; margin-left: 0; }

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

/* Dashboard Layout */
.dashboard-nav {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-nav h1 {
    font-size: 1.25rem;
    color: white;
    background: none;
    -webkit-text-fill-color: unset;
}

.dashboard-nav h1 span {
    color: var(--primary-color);
}

.dashboard-content {
    padding: 1.5rem 2rem;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: 8px;
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}
th, td {
    padding: 0.65rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.88rem;
    white-space: nowrap;
}
th {
    color: var(--text-muted);
    font-weight: 600;
    background: rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 1;
}
td.wrap { white-space: normal; }
tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge.success { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge.warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge.error { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }

/* Summary Cards */
.summary-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}
.summary-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
}
.summary-card .label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Download links in tables */
.dl-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    margin-right: 0.25rem;
    transition: all 0.2s;
}
.dl-link:hover {
    background: var(--primary-color);
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}
.modal-content {
    width: 90%;
    max-width: 500px;
    position: relative;
}
.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}
.close-btn:hover { color: white; }

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    transition: .3s; border-radius: 26px;
}
.toggle-slider:before {
    position: absolute; content: ""; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: var(--text-muted);
    transition: .3s; border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary-color); border-color: var(--primary-color); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); background: white; }

/* Responsive */
@media (max-width: 768px) {
    .dashboard-nav {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }
    .dashboard-content {
        padding: 1rem;
    }
    .tabs-nav {
        flex-direction: column !important;
    }
    .tabs-nav .btn {
        min-width: auto !important;
    }
}
