/* Custom CSS for Election Campaign 2025 */

/* Import Google Fonts for better typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* Custom Properties */
:root {
    --primary-red: #dc2626;
    --primary-blue: #2563eb;
    --primary-yellow: #eab308;
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --border-radius: 1rem;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #374151;
    scroll-behavior: smooth;
}

#semicircularChart { display:block; }
.card-with-chart { padding-top: 0; } /* if you had big top padding */


/* Typography Enhancements */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-red), var(--primary-blue));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #b91c1c, #1d4ed8);
}

.chart-wrapper .seat-result {
    position: absolute;
    bottom: 0;
}

/* Enhanced Card Animations */


.bg-white:hover {   
    box-shadow: var(--shadow-heavy);
}

/* Custom Button Styles */
.btn-primary {
    background: linear-gradient(to right, #dc2626, #b91c1c);
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    transition: var(--transition);
    box-shadow: var(--shadow-medium);
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: linear-gradient(to right, #b91c1c, #991b1b);
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

/* Enhanced Candidate Cards */
#candidate-box {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
}

#candidate-box img {
    transition: var(--transition);
}

#candidate-box img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-heavy);
}

/* Status Badge Animations */
#status1, #status2, #status {
    animation: pulse 2s infinite;
    /* background: linear-gradient(135deg, var(--primary-red), #b91c1c); */
    /* Enhanced status badge styling */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3); */
}

/* Specific status colors - ensure they override any other styles */
#status1.bg-green-600, #status2.bg-green-600, #status.bg-green-600 {
    background-color: #059669 !important;
    background-image: linear-gradient(135deg, #059669, #047857) !important;
    color: white !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3) !important;
}

#status1.bg-red-600, #status2.bg-red-600, #status.bg-red-600 {
    background-color: #dc2626 !important;
    background-image: linear-gradient(135deg, #dc2626, #b91c1c) !important;
    color: white !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3) !important;
}

#status1.bg-yellow-600, #status2.bg-yellow-600, #status.bg-yellow-600 {
    background-color: #d97706 !important;
    background-image: linear-gradient(135deg, #d97706, #b45309) !important;
    color: white !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 4px 8px rgba(217, 119, 6, 0.3) !important;
}

#status1.bg-blue-600, #status2.bg-blue-600, #status.bg-blue-600 {
    background-color: #2563eb !important;
    background-image: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    color: white !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3) !important;
}

#status1.bg-gray-600, #status2.bg-gray-600, #status.bg-gray-600 {
    background-color: #4b5563 !important;
    background-image: linear-gradient(135deg, #4b5563, #374151) !important;
    color: white !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 4px 8px rgba(75, 85, 99, 0.3) !important;
}

/* Hover effects for status badges */
#status1:hover, #status2:hover, #status:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3) !important;
    transition: all 0.3s ease;
}

/* Status badge pulse animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.02);
    }
}

/* Modern Election Dashboard - Complete Redesign */
.election-dashboard-modern {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 
        0 20px 40px -10px rgba(0, 0, 0, 0.1),
        0 10px 20px -5px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.6);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.election-dashboard-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, 
        #dc2626 0%, 
        #ea580c 12%, 
        #d97706 24%, 
        #65a30d 36%, 
        #16a34a 48%, 
        #0d9488 60%,
        #3b82f6 72%,
        #8b5cf6 84%,
        #ec4899 100%);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.election-dashboard-modern:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 32px 64px -12px rgba(0, 0, 0, 0.15),
        0 20px 40px -10px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Dashboard Header */
.dashboard-header {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
    padding: 1.5rem 2rem;
    position: relative;
    overflow: hidden;
}

.dashboard-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.header-title {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.main-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.results-counter {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.declared-seats {
    color: #fbbf24;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.separator {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.total-seats {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.header-status {
    display: flex;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-text {
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Dashboard Content */
.dashboard-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 
        0 4px 12px -2px rgba(0, 0, 0, 0.08),
        0 2px 4px -1px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 20px -4px rgba(0, 0, 0, 0.12),
        0 4px 8px -2px rgba(0, 0, 0, 0.06);
}

.target-card {
    border-left: 4px solid #dc2626;
}

.total-card {
    border-left: 4px solid #3b82f6;
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.8;
    position: relative;
    z-index: 2;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
    z-index: 2;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1f2937;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Chart Section Modern */
.chart-section-modern {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
}

.chart-container-modern {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.8) 100%);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 
        0 8px 20px -4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.chart-wrapper-modern {
    position: relative;
    width: 400px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chart-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

.chart-center-content {
    text-align: center;
}

.center-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.center-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e293b;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Party Results Section */
.party-results-section {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.5) 0%, rgba(241, 245, 249, 0.3) 100%);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(226, 232, 240, 0.4);
}

.section-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
}

.section-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.party-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

/* Enhanced Party Cards for Modern Dashboard */
.party-grid-modern .modern-legend-item {
    background: linear-gradient(135deg, var(--party-color, #6b7280) 0%, var(--party-color-dark, #4b5563) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 8px 16px -4px rgba(0, 0, 0, 0.2),
        0 4px 8px -2px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    min-width: 120px;
    max-width: 140px;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    text-align: center;
}

.party-grid-modern .modern-legend-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
    border-radius: 16px;
    pointer-events: none;
    z-index: 1;
}

.party-grid-modern .modern-legend-item::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.party-grid-modern .modern-legend-item:hover {
    transform: translateY(-6px) scale(1.05);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.3),
        0 10px 10px -5px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.party-grid-modern .modern-legend-item:hover::after {
    opacity: 1;
}

.party-grid-modern .modern-legend-item div:first-child {
    font-size: 1.75rem !important;
    font-weight: 800 !important;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4) !important;
    margin-bottom: 0.25rem !important;
    position: relative !important;
    z-index: 2 !important;
    line-height: 1 !important;
}

.party-grid-modern .modern-legend-item div:last-child {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: white !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    position: relative !important;
    z-index: 2 !important;
    line-height: 1 !important;
}

/* Legacy Chart Container - Keep for compatibility */
.chart-container {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 1.5rem;
    min-height: 320px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 
        0 10px 25px -5px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    backdrop-filter: blur(10px);
}

/* Chart Header Section */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.stats-card {
    text-align: center;   
    position: relative;
    overflow: hidden;
}

.stats-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1f2937;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.target-card {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
    color: white;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 
        0 6px 12px -2px rgba(220, 38, 38, 0.4),
        0 4px 6px -1px rgba(220, 38, 38, 0.2);
    text-align: center;
    min-width: 80px;
    position: relative;
    overflow: hidden;
}

.target-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 1rem;
    pointer-events: none;
}

.target-label {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.95;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    z-index: 1;
}

.target-value {
    position: relative;
    z-index: 1;
}

/* Chart Section */
.chart-section {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 160px;
    padding: 0.25rem 0;
}

.chart-wrapper {
    position: relative;
    width: 360px;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.8) 100%);
    border-radius: 16px;
    padding: 1rem;
    margin-top: 20px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 
        0 8px 16px -4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Target Line Indicator */
.target-line {
    position: absolute;
    top: 0%;
    left: 50%;
    /* transform: translate(-50%, -50%); */
    /* width: 2px;
    height: 60px;
    background: linear-gradient(to bottom, #dc2626, #b91c1c); */
    border-radius: 1px;
    z-index: 10;
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.3);
}

.target-line::before {
    opacity: 0;
    content: '';
    position: absolute;
    top: -2px;
    left: -1px;
    width: 4px;
    height: 4px;
    background: #dc2626;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(220, 38, 38, 0.5);
}

.target-line-text {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 11;
}

.chart-wrapper canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0.75rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

/* Legend Grid - Modern Design */
.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0 0.5rem;
}

.legend-grid-compact {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding: 0.5rem;
    background: rgba(248, 250, 252, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.6);
}

.legend-item {
    background: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
    box-shadow: 
        0 2px 4px -1px rgba(0, 0, 0, 0.1),
        0 1px 2px -1px rgba(0, 0, 0, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-width: 80px;
    max-width: 120px;
}

.legend-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 1rem;
    pointer-events: none;
}

.legend-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.legend-seat-count {
    font-size: 1.25rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    margin-bottom: 0.125rem;
    position: relative;
    z-index: 1;
    line-height: 1;
}

.legend-party-name {
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    z-index: 1;
    line-height: 1;
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, 
        #dc2626 0%, 
        #ea580c 15%, 
        #d97706 30%, 
        #65a30d 45%, 
        #16a34a 60%, 
        #0d9488 75%,
        #3b82f6 90%,
        #8b5cf6 100%);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(220, 38, 38, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(22, 163, 74, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 40% 40%, rgba(59, 130, 246, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 60% 60%, rgba(139, 92, 246, 0.05) 0%, transparent 70%);
    pointer-events: none;
    border-radius: 20px;
    opacity: 0.6;
}

.chart-container canvas {
    border-radius: 0.75rem;
    transition: transform 0.3s ease;
}

.chart-container:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.15),
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border-color: rgba(59, 130, 246, 0.3);
}

.chart-container:hover canvas {
    transform: scale(1.03);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

/* Modern Legend Item Enhancements */
.modern-legend-item {
    position: relative;
    overflow: hidden;
}

.modern-legend-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
    border-radius: 12px;
    pointer-events: none;
    z-index: 1;
}

.modern-legend-item::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.modern-legend-item:hover::after {
    opacity: 1;
}

/* Enhanced Chart Loading States */
.chart-container.loading {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    animation: chartPulse 2s ease-in-out infinite;
}

@keyframes chartPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.95;
        transform: scale(1.01);
    }
}

/* Chart Error State */
.chart-container.error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.desktop-only {
    display: none;
}

/* Mobile-only visibility class */
.mobile-only {
    display: block;
}

/* Media query for desktop view (768px and above) */
@media (min-width: 768px) {
    .desktop-only {
        display: block;
    }
    
    .mobile-only {
        display: none;
    }
}

/* Chart Success State */
.chart-container.success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: rgba(34, 197, 94, 0.3);
}

/* Responsive Design for Modern Dashboard */
@media (max-width: 1024px) {
    .election-dashboard-modern {
        border-radius: 20px;
    }
    
    .dashboard-header {
        padding: 1.25rem 1.5rem;
    }
    
    .dashboard-content {
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    .stats-row {
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .chart-container-modern {
        padding: 1.5rem;
    }
    
    .chart-wrapper-modern {
        width: 360px;
        height: 180px;
    }
    
    .party-grid-modern {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 0.875rem;
    }
    
    /* Legacy chart adjustments */
    .chart-container {
        padding: 1.25rem;
        min-height: 300px;
    }
    
    .chart-wrapper {
        width: 340px;
        height: 170px;
    }
    
    .legend-grid-compact {
        gap: 0.625rem;
        padding: 0.75rem;
    }
    
    .modern-legend-item {
        min-width: 85px;
        max-width: 120px;
        padding: 10px 14px;
    }
}

@media (max-width: 768px) {
    .election-dashboard-modern {
        border-radius: 16px;
    }
    
    .dashboard-header {
        padding: 1rem 1.25rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .main-title {
        font-size: 1.25rem;
    }
    
    .results-counter {
        font-size: 1.125rem;
    }
    
    .dashboard-content {
        padding: 1.25rem;
        gap: 1.25rem;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        font-size: 1.75rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .chart-container-modern {
        padding: 1.25rem;
    }
    
    .chart-wrapper-modern {
        width: 320px;
        height: 160px;
    }
    
    .center-value {
        font-size: 1.25rem;
    }
    
    .party-results-section {
        padding: 1.25rem;
    }
    
    .party-grid-modern {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.75rem;
    }
    
    /* Legacy chart adjustments */
    .chart-container {
        padding: 1rem;
        /* min-height: 280px; */
        border-radius: 16px;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .stats-card, .target-card {
        min-width: auto;
    }
    
    .chart-wrapper {
        width: 300px;
        height: 150px;
        padding: 0.75rem;
        border-radius: 12px;
    }
    
    .legend-grid-compact {
        gap: 0.5rem;
        padding: 0.625rem;
        margin-top: 1rem;
    }
    
    .modern-legend-item {
        padding: 8px 12px;
        min-width: 75px;
        max-width: 110px;
        border-radius: 10px;
    }
    
    .modern-legend-item div:first-child {
        font-size: 1.25rem !important;
    }
    
    .modern-legend-item div:last-child {
        font-size: 0.65rem !important;
    }
    
    .target-line {
        height: 50px;
    }
    
    .target-line-text {
        font-size: 0.7rem;
        top: -20px;
    }
    
    .chart-container::before {
        height: 3px;
    }
}

@media (max-width: 640px) {
    .chart-container {
        padding: 0.75rem;
        /* min-height: 260px; */
        border-radius: 12px;
    }
    
    .chart-wrapper {
        width: 280px;
        height: 140px;
        padding: 0.5rem;
        border-radius: 10px;
    }
    
    .legend-grid-compact {
        gap: 0.375rem;
        padding: 0.5rem;
        margin-top: 0.75rem;
    }
    
    .modern-legend-item {
        padding: 6px 10px;
        min-width: 65px;
        max-width: 95px;
        border-radius: 8px;
    }
    
    .modern-legend-item div:first-child {
        font-size: 1.125rem !important;
    }
    
    .modern-legend-item div:last-child {
        font-size: 0.6rem !important;
    }
    
    .target-line {
        height: 40px;
    }
    
    .target-line-text {
        font-size: 0.65rem;
        top: -18px;
    }
    
    .chart-container canvas {
        border-radius: 0.5rem;
    }
}

@media (max-width: 480px) {
    .chart-container {
        padding: 0.5rem;
        /* min-height: 240px; */
    }
    
    .chart-wrapper {
        width: 260px;
        height: 130px;
    }
    
    .legend-grid-compact {
        gap: 0.25rem;
        padding: 0.375rem;
    }
    
    .modern-legend-item {
        padding: 4px 8px;
        min-width: 60px;
        max-width: 85px;
        border-radius: 6px;
    }
    
    .modern-legend-item div:first-child {
        font-size: 1rem !important;
    }
    
    .modern-legend-item div:last-child {
        font-size: 0.55rem !important;
    }
}

/* Chart Container Focus States */
.chart-container:focus-within {
    outline: 2px solid var(--primary-red);
    outline-offset: 2px;
}

/* Chart Container Print Styles */
@media print {
    .chart-container {
        background: white !important;
        border: 1px solid #d1d5db !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    
    .chart-container::before,
    .chart-container::after {
        display: none;
    }
}

/* Video Player Enhancements - FIXED */
#video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 0.75rem;
    overflow: hidden;
}

#live-video {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-heavy);
    background: #000;
}

/* Video.js specific styling */
.video-js {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #000;
}

.video-js .vjs-tech {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

.video-js .vjs-poster {
    background-size: cover;
    background-position: center;
}

.video-js .vjs-control-bar {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 0 0 0.75rem 0.75rem;
}

.video-js .vjs-big-play-button {
    background: rgba(220, 38, 38, 0.8);
    border: 2px solid #fff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    line-height: 60px;
    margin-left: -30px;
    margin-top: -30px;
}

.video-js .vjs-big-play-button:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

.video-js .vjs-loading-spinner {
    border: 3px solid rgba(220, 38, 38, 0.3);
    border-top-color: var(--primary-red);
}

/* Ensure video is always visible */
.video-js.vjs-fluid,
.video-js.vjs-16-9,
.video-js.vjs-4-3 {
    width: 100% !important;
    height: 100% !important;
}

.candidate1-img.transition-effect, .candidate2-img.transition-effect, .candidate-img.transition-effect {
    transform: scale(1.1);
    outline-color: rgba(239, 68, 68, 0.8);
    box-shadow: 0 25px 50px -12px rgba(239, 68, 68, 0.25);
}

/* News Ticker Enhancements */
#news-ticker {
    position: relative;
}

#news-ticker .animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Map Container */
.delhi-map {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: var(--border-radius);
    /* padding: 1rem; */
    min-height: 400px;
}

/* Loading Animation */
.loading-spinner {
    animation: spin 1s linear infinite;
}

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

/* Responsive Enhancements */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .grid {
        gap: 1rem;
    }
    
    /* Mobile video adjustments */
    #video-container {
        aspect-ratio: 16/9;
    }
    
    .video-js .vjs-big-play-button {
        width: 50px;
        height: 50px;
        line-height: 50px;
        margin-left: -25px;
        margin-top: -25px;
    }
}

@media (max-width: 640px) {    
    #candidate-box {
        padding: 1rem;
    }    

    
    /* Small screen video adjustments */
    #video-container {
        aspect-ratio: 4/3;
    }
}

/* Enhanced Focus States */
a:focus,
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid var(--primary-red);
    outline-offset: 2px;
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Apply animations to sections */
section {
    animation: fadeInUp 0.6s ease-out;
}

section:nth-child(even) {
    animation: slideInLeft 0.6s ease-out;
}

section:nth-child(odd) {
    animation: slideInRight 0.6s ease-out;
}

/* Enhanced Hover Effects */

/* Custom Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-red), var(--primary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Enhanced Shadows */
.shadow-xl {
    box-shadow: var(--shadow-heavy);
}

.shadow-2xl {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Custom Border Radius */
.rounded-2xl {
    border-radius: var(--border-radius);
}

/* Enhanced Transitions */
.transition-all {
    transition: var(--transition);
}

/* Loading Overlay */
#loading-overlay {
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.6);
}

#loading-overlay .bg-white {
    background: rgba(255, 255, 255, 0.95);    
}

/* Enhanced Form Elements */
input, textarea, select {
    border-radius: 0.5rem;
    border: 2px solid #e5e7eb;
    transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Custom Progress Bars */
.progress-bar {
    background: linear-gradient(90deg, var(--primary-red), var(--primary-blue));
    height: 8px;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Enhanced Links */
a {
    transition: var(--transition);
}

a:hover {
    color: var(--primary-red);
}

/* Custom Selection */
::selection {
    background: rgba(220, 38, 38, 0.2);
    color: #1f2937;
}

/* Print Styles */
@media print {
    .bg-white {
        box-shadow: none;       
    }
    
    .bg-gradient-to-r {
        background: #374151 !important;
        color: white !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary-red: #b91c1c;
        --primary-blue: #1d4ed8;
        --primary-yellow: #ca8a04;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body {
        scroll-behavior: auto;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --shadow-light: 0 4px 6px -1px rgba(255, 255, 255, 0.1);
        --shadow-medium: 0 10px 15px -3px rgba(255, 255, 255, 0.1);
        --shadow-heavy: 0 25px 50px -12px rgba(255, 255, 255, 0.25);
    }
}

/* Enhanced Chart Performance Indicators */
.chart-performance-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.chart-performance-indicator .indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: indicatorPulse 2s ease-in-out infinite;
}

.chart-performance-indicator .indicator-dot.high {
    background: #10b981;
}

.chart-performance-indicator .indicator-dot.medium {
    background: #f59e0b;
}

.chart-performance-indicator .indicator-dot.low {
    background: #ef4444;
}

@keyframes indicatorPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

/* Chart Legend Enhancement */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 0.75rem;
    border: 1px solid rgba(226, 232, 240, 0.6);
    backdrop-filter: blur(10px);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border-radius: 0.5rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s ease;
    cursor: pointer;
}

.chart-legend-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-red);
}

.chart-legend-item .legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Chart Tooltip Enhancement */
.chartjs-tooltip {
    background: rgba(31, 41, 55, 0.95) !important;
    border: 2px solid var(--primary-red) !important;
    border-radius: 12px !important;
    padding: 12px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(10px) !important;
}

/* Chart Animation Classes */
.chart-fade-in {
    animation: chartFadeIn 0.8s ease-out;
}

.chart-slide-up {
    animation: chartSlideUp 0.6s ease-out;
}

.chart-scale-in {
    animation: chartScaleIn 0.5s ease-out;
}

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

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

@keyframes chartScaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Chart Responsive Enhancements */
@media (max-width: 1024px) {
    .chart-legend {
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .chart-legend-item {
        padding: 0.375rem 0.625rem;
        font-size: 0.8125rem;
    }
}

@media (max-width: 768px) {
    .chart-performance-indicator {
        top: 0.75rem;
        right: 0.75rem;
        padding: 0.375rem 0.625rem;
        font-size: 0.8125rem;
    }
    
    .chart-legend {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .chart-legend-item {
        width: 100%;
        justify-content: center;
    }
}

/* Chart Accessibility Enhancements */
.chart-container[aria-label] {
    position: relative;
}

.chart-container[aria-label]::before {
    content: attr(aria-label);
    position: absolute;
    top: -2.5rem;
    left: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
    z-index: 20;
}

/* Chart High Contrast Mode */
@media (prefers-contrast: high) {
    .chart-container {
        border: 2px solid #374151;
        background: white;
    }
    
    .chart-container::before {
        height: 6px;
        background: #374151;
    }
    
    .chart-legend-item {
        border: 2px solid #374151;
    }
}

/* Chart Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .chart-container,
    .chart-container canvas,
    .chart-legend-item {
        transition: none;
        animation: none;
    }
    
    .chart-container:hover {
        transform: none;
    }
    
    .chart-container:hover canvas {
        transform: none;
    }
}
