/* ===========================
   CSS Reset & Base Styles
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    
    /* Neutral Colors */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    
    /* Border & Shadow */
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 200ms ease-in-out;
    --transition-slow: 300ms ease-in-out;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-image: url('images/background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    /* Fallback color if image doesn't load */
    background-color: #dc2626;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: var(--spacing-md);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

/* ===========================
   Scrolling Sidebars
   =========================== */
.scroll-sidebar {
    position: fixed;
    top: 0;
    width: 300px;
    height: 100vh;
    overflow: hidden;
    z-index: 1;
    opacity: 0.7;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.left-sidebar {
    left: 0;
}

.right-sidebar {
    right: 0;
}

.scroll-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: scrollDown 120s linear infinite;
    padding: 10px 0;
}

.right-sidebar .scroll-container {
    animation: scrollUp 65s linear infinite;
}

.scroll-sidebar img {
    width: 100%;
    height: auto;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    margin: 0 auto;
    display: block;
}

.scroll-sidebar img:hover {
    transform: scale(1.05);
    opacity: 1;
}

.left-sidebar img:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    border: 2px solid #e74c3c;
}

.scroll-sidebar img.logo-image {
    width: 60%;
    aspect-ratio: auto;
    object-fit: contain;
    padding: 20px;
    background: white;
}

@keyframes scrollDown {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-50%);
    }
}

@keyframes scrollUp {
    0% {
        transform: translateY(-50%);
    }
    100% {
        transform: translateY(0);
    }
}

/* Hide sidebars on tablets and mobile */
@media (max-width: 1600px) {
    .scroll-sidebar {
        display: none;
    }
}

/* ===========================
   Header Styles
   =========================== */
.site-header {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: var(--spacing-xs);
}

.header-logo {
    max-width: 150px;
    height: auto;
    margin-bottom: var(--spacing-md);
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.subtitle {
    font-size: 1.125rem;
    color: #ffffff;
    font-weight: 400;
}

.constituency-header {
    position: relative;
}

.back-button {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-base);
    margin-bottom: var(--spacing-md);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    transform: translateX(-4px);
    border-color: white;
}

/* ===========================
   Search Section (Home Page)
   =========================== */
.search-section {
    display: grid;
    gap: var(--spacing-lg);
}

.search-card {
    background: #e5e7eb;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-xl);
}

.search-card.compact {
    padding: var(--spacing-md);
}

.search-card h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    font-size: 0.95rem;
}

.label-icon {
    font-size: 1.25rem;
}

.form-group select,
.form-group input[type="text"] {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-base);
}

.form-group select:focus,
.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group select:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Button Styles */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    margin-top: var(--spacing-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.25rem;
    transition: transform var(--transition-base);
}

.btn-primary:hover .btn-icon {
    transform: translateX(4px);
}

/* ===========================
   Info Section
   =========================== */
.info-section {
    display: grid;
    gap: var(--spacing-lg);
}

.info-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-lg);
}

.info-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

/* Instructions List */
.instructions {
    list-style: none;
    counter-reset: instruction-counter;
}

.instructions li {
    counter-increment: instruction-counter;
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary);
}

.instructions li::before {
    content: counter(instruction-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* ===========================
   Constituency Page Styles
   =========================== */
.filter-section {
    margin-bottom: var(--spacing-lg);
}

.search-filter {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    background: var(--bg-primary);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.candidate-count {
    background: var(--primary-color);
    color: white;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
}

/* ===========================
   Candidate Cards Grid
   =========================== */
.candidates-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

/* LDF Main Section */
.ldf-main-section {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

/* LDF Horizontal Card */
.ldf-horizontal-card {
    display: flex;
    flex-direction: row;
    gap: 0;
    background: white;
}

.ldf-image-wrapper {
    width: 300px;
    flex-shrink: 0;
}

.ldf-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform var(--transition-base);
}

.ldf-image-wrapper img:hover {
    transform: scale(1.05);
}

.ldf-info-wrapper {
    flex: 1;
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--spacing-md);
}

.ldf-name {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.ldf-party-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: #e74c3c;
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    width: fit-content;
}

.ldf-description-box {
    padding: var(--spacing-lg) var(--spacing-xl);
    background: #ffffff;
    color: #dc2626;
    font-size: 1.05rem;
    line-height: 1.8;
    border-top: 1px solid #e5e7eb;
    min-height: auto;
}

/* Oppositions Section */
.oppositions-section {
    margin-top: var(--spacing-lg);
}

.oppositions-heading {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    padding-left: var(--spacing-sm);
}

.oppositions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.opposition-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    min-height: auto;
}

.opposition-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.opposition-info {
    padding: var(--spacing-md);
}

.opposition-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.opposition-party {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Legacy styles kept for compatibility */
.featured-column {
    display: none;
}

.small-cards-column {
    display: none;
}

.candidate-card {
    display: none;
}

.party-icon {
    font-size: 1rem;
}

/* ===========================
   Image Modal
   =========================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: zoom-out;
    animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    display: block;
    margin: 5% auto;
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
    animation: zoomIn var(--transition-slow);
}

@keyframes zoomIn {
    from { transform: scale(0.7); }
    to { transform: scale(1); }
}

.close-modal {
    position: absolute;
    top: 2rem;
    right: 3rem;
    color: white;
    font-size: 3rem;
    font-weight: 300;
    cursor: pointer;
    transition: transform var(--transition-base);
}

.close-modal:hover {
    transform: scale(1.2);
}

.modal-caption {
    text-align: center;
    color: white;
    padding: var(--spacing-md);
    font-size: 1.125rem;
}

/* ===========================
   Utility States
   =========================== */
.no-results,
.error-message {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    box-shadow: var(--shadow-md);
}

.no-results p,
.error-message p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.error-message p {
    color: #ef4444;
}

/* ===========================
   Footer
   =========================== */
.site-footer {
    text-align: center;
    padding: var(--spacing-lg);
    color: white;
    margin-top: var(--spacing-xl);
}

.site-footer p {
    font-size: 0.875rem;
    opacity: 0.9;
}

.visit-counter {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-md);
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 500;
}

.visit-counter .count-label {
    opacity: 0.8;
    margin-right: var(--spacing-xs);
}

.visit-counter .count-number {
    font-weight: 700;
    font-size: 1rem;
}

/* ===========================
   Responsive Design
   =========================== */

/* Tablet */
@media (min-width: 768px) {
    body {
        padding: var(--spacing-lg);
    }
    
    .info-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .oppositions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .header-content h1 {
        font-size: 3rem;
    }
}

/* Mobile */
@media (max-width: 767px) {
    body {
        padding: var(--spacing-sm);
    }
    
    .site-header {
        padding: var(--spacing-lg);
    }
    
    .header-content h1 {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .search-card {
        padding: var(--spacing-lg);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .ldf-horizontal-card {
        flex-direction: column;
    }
    
    .ldf-image-wrapper {
        width: 100%;
        height: 300px;
    }
    
    .ldf-info-wrapper {
        padding: var(--spacing-md);
    }
    
    .ldf-name {
        font-size: 1.5rem;
    }
    
    .ldf-description-box {
        padding: var(--spacing-md);
        font-size: 1rem;
    }
    
    .oppositions-heading {
        font-size: 1.25rem;
    }
    
    .oppositions-grid {
        grid-template-columns: 1fr;
    }
    
    .close-modal {
        top: 1rem;
        right: 1.5rem;
        font-size: 2.5rem;
    }
    
    .section-header {
        flex-direction: column;
        gap: var(--spacing-sm);
        text-align: center;
    }
}

/* Extra Small Mobile */
@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .ldf-name {
        font-size: 1.25rem;
    }
    
    .opposition-name {
        font-size: 1rem;
    }
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    body {
        background: white;
    }
    
    .back-button,
    .filter-section,
    .site-footer {
        display: none;
    }
    
    .candidate-card {
        break-inside: avoid;
    }
}
