/* ==========================================================================
   Modern E-Voting System Custom Stylesheet
   Theme Palette: Royal Blue (#2563EB), Dark Slate (#0F172A), Teal (#14B8A6)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #0f172a;
    --accent-color: #14b8a6;
    --bg-body: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 25px -5px rgba(37, 99, 235, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 35px -10px rgba(15, 23, 42, 0.12), 0 10px 20px -5px rgba(0, 0, 0, 0.04);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism utility */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.glass-card:hover {
    box-shadow: var(--shadow-lg);
}

/* Custom Navigation Bar */
.navbar-custom {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.brand-badge {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Hero Section */
.hero-gradient {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(20, 184, 166, 0.08) 100%);
    border-radius: 24px;
    padding: 3.5rem 2rem;
    position: relative;
    overflow: hidden;
}

.hero-gradient::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
}

/* Voting Code Input Box */
.code-input-group {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.code-input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.code-input-group input {
    border: none;
    outline: none;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--primary-color);
    background: transparent;
    text-align: center;
}

/* Candidate Card Styling */
.candidate-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.candidate-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(37, 99, 235, 0.4);
}

.candidate-img-wrapper {
    position: relative;
    width: 100%;
    height: 280px;
    background-color: var(--bg-body);
    overflow: hidden;
}

.candidate-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.5s ease;
}

.candidate-card:hover .candidate-img-wrapper img {
    transform: scale(1.05);
}

.candidate-number-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #ffffff;
    font-weight: 800;
    font-size: 1.25rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    border: 3px solid #ffffff;
}

/* Dashboard SaaS Layout */
.dashboard-layout {
    display: flex;
    min-height: calc(100vh - 70px);
}

.sidebar {
    width: 270px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    flex-shrink: 0;
    transition: var(--transition);
}

.main-content {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1.15rem;
    color: var(--text-muted);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition);
    text-decoration: none;
    margin-bottom: 0.35rem;
}

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

.nav-link-custom:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.08);
}

.nav-link-custom.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-color), #1d4ed8);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Metric Widget Cards */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary { background: rgba(37, 99, 235, 0.12); color: var(--primary-color); }
.stat-icon.success { background: rgba(20, 184, 166, 0.12); color: var(--accent-color); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.stat-icon.danger { background: rgba(239, 68, 68, 0.12); color: #ef4444; }

/* Pulse Live Indicator */
.pulse-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    background: rgba(20, 184, 166, 0.12);
    color: var(--accent-color);
    font-weight: 700;
    font-size: 0.85rem;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
    border-radius: 50%;
    animation: pulse-animation 1.5s infinite;
}

@keyframes pulse-animation {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(20, 184, 166, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(20, 184, 166, 0); }
}

/* Custom Buttons */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary-color), #1d4ed8);
    border: none;
    color: #ffffff;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transition: var(--transition);
}

.btn-primary-custom:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
    transform: translateY(-2px);
}

/* Voting Code Ticket Grid (Print Layout) */
.ticket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}

.ticket-card {
    border: 1.5px dashed var(--primary-color);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    background: var(--card-bg);
    text-align: center;
    position: relative;
    box-sizing: border-box;
}

.ticket-code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--primary-color);
    line-height: 1.2;
}

/* Print Stylesheet */
@media print {
    @page {
        size: A4 portrait;
        margin: 8mm 10mm;
    }
    html, body {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 8.5pt !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .no-print, .sidebar, .navbar-custom, .btn, footer, header {
        display: none !important;
    }
    .dashboard-layout, .main-content {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    .ticket-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 5mm 5mm !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .ticket-card {
        border: 1px dashed #333333 !important;
        border-radius: 4px !important;
        padding: 6px 8px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        background: #ffffff !important;
        box-sizing: border-box !important;
        width: 100% !important;
        overflow: hidden !important;
    }
    .ticket-code {
        color: #000000 !important;
        font-size: 10pt !important;
        font-family: 'Courier New', Courier, monospace !important;
        font-weight: bold !important;
    }
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .dashboard-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}
