/* FIEM ACM Secure Voting System - Custom Styles */

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

/* ===== CSS Variables ===== */
:root {
    /* Dark Theme (Default) */
    --bg-page: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0f172a;
    --bg-sidebar-active: rgba(99, 102, 241, 0.15);
    --bg-input: #0f172a;
    --bg-topbar: rgba(15, 23, 42, 0.8);
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #ffffff;
    
    --border-main: rgba(99, 102, 241, 0.2);
    --border-light: rgba(255, 255, 255, 0.05);
    
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --success: #10b981;
    --danger: #ef4444;
    
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --glass: blur(12px);
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
}

body.light-mode, html.light-mode body {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #f8fafc;
    --bg-sidebar-active: #eff6ff;
    --bg-input: #ffffff;
    --bg-topbar: rgba(255, 255, 255, 0.9);
    
    --text-main: #020617;
    --text-muted: #334155;
    --text-sidebar: #1e293b;
    --text-sidebar-active: #4f46e5;
    
    --border-main: #cbd5e1;
    --border-light: #e2e8f0;
    
    --accent: #4f46e5;
    --accent-hover: #3730a3;
    
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    --glass: blur(20px);
}

/* ===== Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-page);
    color: var(--text-main);
    transition: background 0.2s ease, color 0.2s ease;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    opacity: 0;
    animation: fadeInPage 0.4s ease forwards;
}

@keyframes fadeInPage {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== Layout Components ===== */

.ui-card {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

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

.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2) !important; border-color: var(--danger); transform: translateY(-1px); }

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-main);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
}
.form-input:focus { 
    border-color: var(--accent); 
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== Admin Sidebar (Enhanced Collapsible) ===== */
.admin-sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-main);
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0;
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-sidebar .logo-section {
    padding: 24px;
    border-bottom: 1px solid var(--border-light);
    height: 80px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.admin-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.admin-sidebar .nav-item:hover {
    color: var(--text-main);
    background: var(--bg-sidebar-active);
}

.admin-sidebar .nav-item.active {
    color: var(--text-sidebar-active);
    background: var(--bg-sidebar-active);
    border-left: 4px solid var(--accent);
    padding-left: 20px;
    font-weight: 700;
}
.admin-sidebar .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.admin-sidebar .nav-label-group {
    padding: 24px 24px 8px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.admin-sidebar .logo-text,
.admin-sidebar .nav-item span,
.admin-sidebar .user-box-bottom {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Collapsed State Styles */
body.sidebar-collapsed .admin-sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .admin-sidebar .logo-text,
body.sidebar-collapsed .admin-sidebar .nav-item span,
body.sidebar-collapsed .admin-sidebar .nav-label-group,
body.sidebar-collapsed .admin-sidebar .user-box-bottom {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
    position: absolute;
    white-space: nowrap;
}

body.sidebar-collapsed .admin-sidebar .nav-item {
    justify-content: center;
    padding: 14px 0;
}

body.sidebar-collapsed .admin-sidebar .logo-section {
    padding: 16px 0;
    justify-content: center;
}

body.sidebar-collapsed .admin-sidebar .logout-btn {
    padding: 10px 0;
    justify-content: center;
    width: 44px;
    margin: 0 auto;
}

body.sidebar-collapsed .admin-sidebar .nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--accent);
    border-right: 4px solid var(--accent);
}

/* ===== Nav Items & Logout ===== */
.logout-btn { 
    color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.1);
    border-radius: 10px;
    padding: 10px 16px;
    transition: all 0.3s ease;
}
.logout-btn:hover { 
    background: rgba(239, 68, 68, 0.15) !important; 
    border-color: var(--danger) !important; 
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
}

.admin-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-page);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .admin-main {
    margin-left: var(--sidebar-collapsed-width);
}

.admin-topbar {
    padding: 16px 32px;
    border-bottom: 1px solid var(--border-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-topbar);
    backdrop-filter: var(--glass);
    position: sticky;
    top: 0;
    z-index: 900;
}

/* ===== Table ===== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table th {
    padding: 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-main);
}
.data-table td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
}
.data-table tr:hover td { background: rgba(99, 102, 241, 0.02); }

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-active   { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-inactive { background: rgba(239, 68, 68, 0.1);  color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }

/* ===== Custom Alerts ===== */
.custom-alert {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    animation: toastIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
    backdrop-filter: blur(12px);
    max-width: 380px;
}
@media (max-width: 480px) {
    .custom-alert {
        left: 16px;
        right: 16px;
        top: 16px;
        max-width: none;
        min-width: 0;
    }
}
@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.alert-content { flex: 1; }
.alert-close { 
    background: none; border: none; padding: 4px; color: inherit; 
    opacity: 0.5; cursor: pointer; transition: opacity 0.2s; 
    display: flex; align-items: center; justify-content: center;
}
.alert-close:hover { opacity: 1; }

.alert-success { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.2); color: var(--success); }
.alert-error   { background: rgba(239, 68, 68, 0.1);  border-color: rgba(239, 68, 68, 0.2);  color: var(--danger); }
.alert-warning { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.alert-info    { background: rgba(99, 102, 241, 0.1); border-color: rgba(99, 102, 241, 0.2); color: var(--accent); }

/* ===== Custom Modals ===== */
.custom-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); 
    backdrop-filter: blur(8px); z-index: 9999; display: flex; 
    align-items: center; justify-content: center; opacity: 0; 
    transition: opacity 0.3s ease; pointer-events: none; padding: 20px;
}
.custom-modal-overlay.open { opacity: 1; pointer-events: auto; }
.custom-modal {
    background: var(--bg-card); border: 1px solid var(--border-main); 
    border-radius: 24px; width: 100%; max-width: min(400px, calc(100vw - 40px)); 
    padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); 
    transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-tap-highlight-color: transparent;
}
.custom-modal-overlay.open .custom-modal { transform: scale(1); }
.modal-body p { font-size: 16px; font-weight: 600; color: var(--text-main); margin-bottom: 24px; text-align: center; line-height: 1.5; }
.modal-footer { display: flex; gap: 12px; }
.modal-footer .btn { flex: 1; justify-content: center; padding: 12px; }

/* ===== Animations ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-100%); width: 280px !important; transition: transform 0.3s; }
    body.sidebar-open .admin-sidebar { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,0.4); }
    .admin-main { margin-left: 0 !important; }
    body.sidebar-collapsed .admin-main { margin-left: 0 !important; }
    .sidebar-overlay.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 999; backdrop-filter: blur(4px); }
    
    /* Reset collapsed hide behavior on mobile drawer */
    body.sidebar-collapsed .admin-sidebar .logo-text,
    body.sidebar-collapsed .admin-sidebar .nav-item span,
    body.sidebar-collapsed .admin-sidebar .nav-label-group,
    body.sidebar-collapsed .admin-sidebar .user-box {
        display: block !important;
        opacity: 1 !important;
        width: auto !important;
    }
}

/* ===== Utilities ===== */
.mb-8 { margin-bottom: 32px; }
.mb-6 { margin-bottom: 24px; }
.text-center { text-align: center; }

/* Theme Toggle Icons */
.light-icon { display: none !important; }
.dark-icon { display: block !important; }
.light-mode .light-icon { display: block !important; }
.light-mode .dark-icon { display: none !important; }

/* Global Button Fix for Mobile Icons */
.btn i, .btn svg { pointer-events: none; }

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-page); }
::-webkit-scrollbar-thumb { background: var(--border-main); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
