/* --- 1. SETTINGS & VARIABLES --- */
:root {
    --primary: #4c1d95;
    --secondary: #6d28d9;
    --bg-light: #f3f4f6;
    --white: #ffffff;
    --text-dark: #1f2937;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.swal2-container {
    z-index: 9999 !important;
}

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
}

/* Add/Replace these in your style.css */
.hidden { display: none !important; }

/* --- 2. SIDEBAR NAVIGATION --- */
.sidebar {
    width: 250px;
    height: 100vh;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    padding: 25px 15px;
    z-index: 1000;
}
.nav-item.active {
    background: #0061ff; /* Midabka marka la riixo */
    color: white !important;
    border-left: 5px solid #ffcc00; /* Line jaalle ah oo dhinaca ka soo baxa */
}

.sidebar-brand {
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
    padding-left: 10px;
}

.sidebar-links {
    list-style: none;
    padding: 0;
}

.sidebar-links li {
    padding: 14px 18px;
    cursor: pointer;
    border-radius: 10px;
    margin-bottom: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-links li:hover, .sidebar-links li.active {
    background: rgba(255, 255, 255, 0.2);
}
/* Sidebar active item highlight */
.sidebar-links li.active {
    background: rgba(255, 255, 255, 0.2);
    border-left: 4px solid white;
}
/* --- 3. MAIN CONTENT LAYOUT --- */
.container {
    margin-left: 250px;
    padding: 30px;
}

.card {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    box-sizing: border-box; /* Ensure padding doesn't break layout */
    width: 100%; /* Full width by default */
}




/* --- MOBILE RESPONSIVE STYLING --- */
@media (max-width: 480px) {
    .card {
        padding: 15px;      /* Reduce padding on small screens */
        margin-bottom: 15px; /* Reduce spacing between cards */
        border-radius: 10px; /* Slightly smaller corners */
        font-size: 14px;     /* Adjust text size for readability */
    }
}


/* --- 4. DASHBOARD CARDS (The 6 Cards) --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.dash-card {
    padding: 25px;
    border-radius: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.dash-card:hover {
    transform: translateY(-5px);
}

.dash-card h4 {
    margin: 0;
    font-size: 14px;
    text-transform: uppercase;
    opacity: 0.8;
}

.dash-card p {
    margin: 8px 0 0 0;
    font-size: 32px;
    font-weight: 800;
}

.dash-card i {
    font-size: 40px;
    opacity: 0.3;
}

/* Gradient Colors for Cards */
.card-blue { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.card-purple { background: linear-gradient(135deg, #5b21b6, #8b5cf6); }
.card-green { background: linear-gradient(135deg, #065f46, #10b981); }
.card-orange { background: linear-gradient(135deg, #9a3412, #f97316); }
.card-red { background: linear-gradient(135deg, #991b1b, #ef4444); }
.card-dark { background: linear-gradient(135deg, #111827, #374151); }

/* --- 5. TABLES & ACTIONS --- */
.table-full {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;

}

.table-full th,
.table-full td {
    padding: 12px 15px;
    border-bottom: 1px solid #edf2f7;
    white-space: nowrap; /* Prevent text from wrapping */
}

.table-full th {
    text-align: left;
    background: #f9fafb;
    border-bottom: 2px solid #edf2f7;
    color: #64748b;
}

/* --- MOBILE ADJUSTMENTS --- */
@media (max-width: 600px) {
    .table-full {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    overflow-x: auto; /* Allows horizontal scroll on small screens */
    display: block;   /* Enable scrolling */
}
    .table-full {
        font-size: 14px; /* Slightly smaller text */
    }

    .table-full th,
    .table-full td {
        padding: 8px 10px; /* Reduce padding */
    }
}


/* Buttons */
button {
    cursor: pointer;
    font-weight: 700;
    border-radius: 8px;
}

button.primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
}

.btn-edit {
    background: #f59e0b;
    color: white;
    border: none;
    padding: 6px 12px;
    margin-right: 5px;
}

.btn-del {
    background: #ef4444;
    color: white;
    border: none;
    padding: 6px 12px;
}

/* Election Control Buttons */
.btn-start {
    background: #059669;
    color: white;
    border: none;
    padding: 10px 20px;
    margin-right: 10px;
}

.btn-stop {
    background: #dc2626;
    color: white;
    border: none;
    padding: 10px 20px;
}

/* --- 6. MODAL STYLING --- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

/* Modal activation fix */
.modal.show {
    display: flex !important;
}

.modal-content {
    background: white;
    padding: 35px;
    border-radius: 20px;
    width: 420px;
    max-width: 90%; /* Ensures modal doesn't overflow on small screens */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    box-sizing: border-box; /* Prevent padding from breaking layout */
}

.modal-actions {
    display: flex;          /* Enables Flexbox */
    justify-content: flex-end; /* Pushes content to the right */
    gap: 10px;             /* Adds space between the buttons */
    margin-top: 20px;      /* Adds breathing room above the buttons */
}

/* Optional: styling to make the buttons look distinct */
.modal-actions button {
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
}

/* --- MOBILE RESPONSIVE STYLING --- */
@media (max-width: 480px) {
    .modal-content {
        width: 90%;          /* Max 90% of screen width */
        max-width: 400px;    /* Don't exceed 400px */
        height: auto;        /* Let height grow with content */
        max-height: 90vh;    /* Prevent modal from exceeding screen height */
        padding: 20px;       /* Comfortable padding */
        border-radius: 12px; /* Slightly smaller radius */
        overflow-y: auto;    /* Enable scroll if content is too tall */
    }

    .modal-actions {
        flex-direction: column; /* Stack buttons vertically */
        align-items: stretch;   /* Buttons take full width */
        gap: 8px;               /* Smaller spacing */
    }

    .modal-actions button {
        width: 100%;      /* Buttons expand full width */
        padding: 10px 0;  /* More tappable */
        font-size: 16px;  /* Slightly bigger for mobile touch */
    }
}


input, select {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .container { margin-left: 0; padding: 15px; }
}




.charts-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:18px;margin-top:18px}
.chart-card{padding:14px;border-radius:12px;box-shadow:0 6px 16px rgba(2,6,23,0.06);background:#fff}
.chart-card canvas{transition:opacity .4s ease;opacity:0}
.chart-card.show canvas{opacity:1}
/* Ensure canvas takes up space but doesn't overflow */
.chart-card canvas {
    max-height: 200px !important;
}
.charts-grid > .chart-card:nth-child(1), .charts-grid > .chart-card:nth-child(2){grid-column:span 1}
.charts-grid > .chart-card:nth-child(3){grid-column:1 / -1}


/* ===== MOBILE MENU TOGGLE ===== */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 3000;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 14px;
    font-size: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}
/* Hide toggle menu on login page */
#loginWrapper #loginWrapper{
    display: none !important;
}


/* Mobile sidebar hidden by default */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .container {
        margin-left: 0;
        padding-top: 60px;
    }
}
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}






