/* ==================== RESET ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
}

:root {
    --primary: #8B5CF6;
    --primary-dark: #7C3AED;
    --accent: #06B6D4;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --bg: #0A0A15;
    --bg2: #0F0F1A;
    --card: #1A1A2E;
    --card-hover: #252540;
    --text: #F1F5F9;
    --text-muted: #94A3B8;
    --border: #2D2D44;
}

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

/* ==================== PARTICLES ==================== */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.4;
    animation: float 15s infinite linear;
}

@keyframes float {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { transform: translateY(-100vh) scale(1); opacity: 0; }
}

/* ==================== LOGIN ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--card);
    border-radius: 20px;
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.15),
                0 0 0 1px rgba(139, 92, 246, 0.1);
    animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 15px;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 15px 40px rgba(139, 92, 246, 0.6); }
}

.logo h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #8B5CF6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 5px;
}

.input-group {
    position: relative;
    margin-bottom: 15px;
}

.input-group .icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    opacity: 0.6;
}

.input-group input {
    width: 100%;
    padding: 15px 15px 15px 50px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 15px;
    transition: all 0.3s;
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
    background: var(--card);
}

/* ==================== BUTTONS ==================== */
.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4);
}

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

.btn-primary.small {
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
    margin-top: 0;
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--card-hover);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

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

.btn-refresh {
    padding: 8px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.btn-refresh:hover {
    background: var(--card-hover);
    color: var(--primary);
    transform: rotate(180deg);
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s;
}

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

.login-status {
    text-align: center;
    margin-top: 15px;
    font-size: 13px;
    min-height: 20px;
    color: var(--danger);
}

/* ==================== DASHBOARD LAYOUT ==================== */
.dashboard {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: 0.3s;
}

.sidebar-logo {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.logo-icon.small {
    width: 36px;
    height: 36px;
    font-size: 20px;
    border-radius: 10px;
    margin: 0;
    animation: none;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--card-hover);
    color: var(--text);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.1));
    color: var(--primary);
    font-weight: 600;
}

.nav-item span {
    font-size: 18px;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border);
}

.user-badge {
    padding: 10px 15px;
    background: var(--bg2);
    border-radius: 10px;
    margin-bottom: 10px;
}

.user-badge span {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.user-badge small {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 20px 30px;
    min-height: 100vh;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 25px;
}

.topbar h2 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #8B5CF6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.topbar-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.time {
    font-size: 13px;
    color: var(--text-muted);
    font-family: monospace;
    background: var(--card);
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* ==================== TABS ==================== */
.tab-content {
    display: none;
    animation: fadeIn 0.4s;
}

.tab-content.active {
    display: block;
}

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

/* ==================== STATS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.5s backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card.purple::before { background: linear-gradient(180deg, #8B5CF6, #A78BFA); }
.stat-card.green::before { background: linear-gradient(180deg, #10B981, #34D399); }
.stat-card.cyan::before { background: linear-gradient(180deg, #06B6D4, #22D3EE); }
.stat-card.orange::before { background: linear-gradient(180deg, #F59E0B, #FBBF24); }

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(139, 92, 246, 0.15);
    border-color: var(--primary);
}

.stat-icon {
    font-size: 32px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg2);
    border-radius: 14px;
}

.stat-info h3 {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 4px;
}

.stat-card.purple .stat-info h3 { color: #A78BFA; }
.stat-card.green .stat-info h3 { color: #34D399; }
.stat-card.cyan .stat-info h3 { color: #22D3EE; }
.stat-card.orange .stat-info h3 { color: #FBBF24; }

.stat-info p {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

/* ==================== QUICK ACTIONS ==================== */
.quick-actions h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.action-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px 15px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.action-card:hover {
    background: var(--card-hover);
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(139, 92, 246, 0.2);
}

.action-icon {
    font-size: 32px;
}

/* ==================== TABLES ==================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
    flex-wrap: wrap;
}

.search-box {
    padding: 10px 15px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    width: 250px;
    outline: none;
    transition: 0.3s;
}

.search-box:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.table-container {
    background: var(--card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    animation: fadeIn 0.4s;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

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

.data-table tbody tr {
    transition: background 0.2s;
}

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

.data-table .empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.success { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.badge.danger { background: rgba(239, 68, 68, 0.15); color: #F87171; }
.badge.warning { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.badge.info { background: rgba(6, 182, 212, 0.15); color: #22D3EE; }

.btn-icon {
    padding: 6px 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    margin-right: 5px;
    transition: 0.2s;
}

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

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

/* ==================== FORMS ==================== */
.form-container {
    background: var(--card);
    border-radius: 16px;
    padding: 30px;
    max-width: 550px;
    border: 1px solid var(--border);
    animation: fadeIn 0.4s;
}

.form-container h3 {
    margin-bottom: 25px;
    font-size: 20px;
    background: linear-gradient(135deg, #fff, #8B5CF6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 13px 15px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.radio-group {
    display: flex;
    gap: 10px;
}

.radio-card {
    flex: 1;
    padding: 15px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    font-size: 14px;
    font-weight: 600;
}

.radio-card input {
    display: none;
}

.radio-card.active {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
}

.result-box {
    margin-top: 20px;
    padding: 15px;
    background: var(--bg2);
    border-radius: 12px;
    font-family: monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.result-box:not(:empty) {
    display: block;
}

/* ==================== SETTINGS ==================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.settings-card {
    background: var(--card);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid var(--border);
    animation: fadeIn 0.4s;
}

.settings-card h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

.settings-card p {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 55px;
    height: 30px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    border-radius: 30px;
    transition: 0.4s;
}

.slider:before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background: white;
    border-radius: 50%;
    transition: 0.4s;
}

.switch input:checked + .slider {
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

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

.text-input {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    margin-bottom: 12px;
    transition: 0.3s;
}

.text-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

/* ==================== TOASTS ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 15px 20px;
    background: var(--card);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    font-size: 14px;
    min-width: 250px;
    animation: slideIn 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast .icon { font-size: 20px; }

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s;
    backdrop-filter: blur(5px);
}

.modal {
    background: var(--card);
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--border);
    animation: slideUp 0.3s;
}

.modal h3 {
    margin-bottom: 20px;
    font-size: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
    padding: 12px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-info h3 {
        font-size: 20px;
    }
    
    .search-box {
        width: 100%;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .topbar h2 {
        font-size: 18px;
    }
    
    .form-container {
        padding: 20px;
    }
}

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