/* ==========================================================================
   FILE: style.css
   PROJECT: Indian Voters (DeshMainKaam)
   PURPOSE: Ultra-Smooth, Zero-Lag, Spacious Premium UI
   APPROACH: Hardware Accelerated, Minimal Animations, High Legibility
========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS VARIABLES (THEMING & SPACING)
   * Removed heavy blurs. Using solid/semi-solid colors for zero lag.
-------------------------------------------------------------------------- */
:root, [data-theme="dark"] {
    /* Color Palette - Dark Mode */
    --bg-base: #0a0a0a;
    --bg-surface: #141414;
    --bg-surface-elevated: #1e1e1e;
    --bg-surface-hover: #2a2a2a;
    
    --border-light: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-inverse: #000000;
    
    /* Brand Colors */
    --accent-primary: #ffffff;
    --accent-secondary: #e4e4e7;
    --neon-blue: #3b82f6;
    --success-green: #10b981;
    --danger-red: #ef4444;
    
    /* Spacing System (Increased for spacious look) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 16px;
    --space-4: 24px;
    --space-5: 32px;
    --space-6: 48px;
    --space-7: 64px;
    
    /* Shadows - Optimized, no heavy spreading */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
    
    /* Transitions */
    --transition-fast: 0.15s ease-out;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    /* Color Palette - Light Mode */
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --bg-surface-hover: #e2e8f0;
    
    --border-light: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.15);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Brand Colors */
    --accent-primary: #0f172a;
    --accent-secondary: #334155;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   2. RESET & BASE (PERFORMANCE OPTIMIZATIONS)
-------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* Removes blue tap highlight on mobile */
}

html {
    scroll-behavior: smooth;
    font-size: 16px; /* Base size */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    /* Font rendering optimizations */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    /* Hardware acceleration for body scrolling */
    transform: translateZ(0); 
}

/* Scrollbar Styling (Minimal) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* --------------------------------------------------------------------------
   3. TYPOGRAPHY (CRISP & SPACIOUS)
-------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

p {
    margin-bottom: var(--space-3);
    color: var(--text-secondary);
}

.display-large { 
    font-size: clamp(2.2rem, 5vw, 3.5rem); 
    font-weight: 800; 
    letter-spacing: -0.03em; 
    line-height: 1.1;
}

.title-large { 
    font-size: clamp(1.4rem, 3vw, 1.8rem); 
    font-weight: 700; 
    letter-spacing: -0.01em; 
}

.title-medium { 
    font-size: clamp(1.15rem, 2.5vw, 1.4rem); 
    font-weight: 600; 
}

.title-small { 
    font-size: 1.05rem; 
    font-weight: 600; 
}

.body-large { 
    font-size: 1.1rem; 
    line-height: 1.7; 
}

.body-medium { 
    font-size: 1rem; 
    line-height: 1.6; 
}

.body-small { 
    font-size: 0.875rem; 
    line-height: 1.5; 
}

.label-large { 
    font-size: 0.875rem; 
    font-weight: 600; 
    letter-spacing: 0.02em; 
}

.label-medium { 
    font-size: 0.75rem; 
    font-weight: 600; 
    letter-spacing: 0.04em; 
}

.label-small { 
    font-size: 0.65rem; 
    font-weight: 700; 
    letter-spacing: 0.08em; 
    text-transform: uppercase; 
}

/* Font Weights */
.font-black { font-weight: 900; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-muted { color: var(--text-secondary); }
.text-accent { color: var(--text-primary); }
.text-gradient {
    /* Safe fallback gradient */
    background: linear-gradient(135deg, var(--text-primary) 20%, var(--text-tertiary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.letter-spacing-wide { letter-spacing: 0.1em; }

/* --------------------------------------------------------------------------
   4. LAYOUT & GRID SYSTEMS
-------------------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.section {
    /* Massive spacing between sections to avoid "chipka hua" look */
    margin-top: var(--space-7);
    margin-bottom: var(--space-7);
}

.hero-section {
    padding-top: 120px; /* Space for fixed navbar */
    padding-bottom: var(--space-5);
}

.relative { position: relative; }
.z-10 { z-index: 10; }

/* Flexbox Helpers */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center-start { display: flex; align-items: center; justify-content: flex-start; }
.flex-column { display: flex; flex-direction: column; }
.align-start { align-items: flex-start; }

/* Gap Utilities */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* Spacing Utilities */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }

.w-100 { width: 100%; }
.max-w-600 { max-width: 600px; }
.max-w-400 { max-width: 400px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.d-none { display: none !important; }

/* Grids */
.grid-2-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-3);
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-4);
}

/* --------------------------------------------------------------------------
   5. UI COMPONENTS (CARDS, BADGES, SURFACES)
   * Removed blur. Using solid RGBA for crisp edges and high FPS.
-------------------------------------------------------------------------- */
.glass-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    /* Hardware acceleration for hover effects */
    transform: translateZ(0); 
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.glass-panel {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: 24px;
}

/* Hover effects optimized */
.outline-hover:hover {
    border-color: var(--border-strong);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.neon-blue {
    color: var(--neon-blue);
    border-color: rgba(59, 130, 246, 0.3);
    background-color: rgba(59, 130, 246, 0.1);
}

.badge-pulse { position: relative; }
.badge-pulse::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    background-color: var(--success-green);
    border-radius: 50%;
    margin-right: 6px;
}

/* --------------------------------------------------------------------------
   6. NAVBAR (FIXED, NO LAG)
-------------------------------------------------------------------------- */
.floating-navbar {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 800px;
    height: 60px;
    padding: 0 var(--space-3);
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-surface);
    /* Safe fallback if browser doesn't support blur, but keeps it light */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
}

.brand-dot {
    width: 8px; height: 8px;
    background-color: var(--text-primary);
    border-radius: 50%;
}

.nav-divider {
    width: 1px; height: 24px;
    background-color: var(--border-light);
}

.profile-btn {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-light);
    padding: 6px 16px 6px 6px;
    border-radius: 100px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}
.profile-btn:hover { background-color: var(--bg-surface-hover); }

.avatar-circle {
    width: 28px; height: 28px;
    border-radius: 50%;
    background-color: var(--accent-primary);
    color: var(--bg-base);
    display: flex; align-items: center; justify-content: center;
}

/* --------------------------------------------------------------------------
   7. BUTTONS, INPUTS & FORMS
-------------------------------------------------------------------------- */
button, input {
    font-family: inherit;
    outline: none;
    border: none;
    background: none;
}

.icon-btn {
    color: var(--text-primary);
    cursor: pointer;
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background-color var(--transition-fast);
}
.icon-btn:hover { background-color: var(--bg-surface-elevated); }

.badge-btn {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-light);
    padding: 8px 16px;
    border-radius: 100px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: var(--bg-base);
    padding: 16px 24px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.1s;
}

.glass-input {
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}
.glass-input:focus { border-color: var(--text-primary); }

/* Haptic touch animation */
.haptic-btn {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.1s ease-in-out;
}
.haptic-btn:active { transform: scale(0.96); }

/* --------------------------------------------------------------------------
   8. MEGA POLL SECTION (Fixed Alignment & Spacing)
-------------------------------------------------------------------------- */
.stat-box {
    background-color: var(--bg-surface-elevated);
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.progress-track {
    width: 100%;
    height: 8px;
    background-color: var(--bg-surface-hover);
    border-radius: 100px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--text-primary);
    border-radius: 100px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-vote {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-light);
    padding: 18px 20px; /* Increased height for better touch area */
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.yes-btn:hover { background-color: rgba(16, 185, 129, 0.1); border-color: var(--success-green); color: var(--success-green); }
.no-btn:hover { background-color: rgba(239, 68, 68, 0.1); border-color: var(--danger-red); color: var(--danger-red); }

/* --------------------------------------------------------------------------
   9. VIDEO IFRAME FIX (Perfect 16:9 Ratio)
-------------------------------------------------------------------------- */
.video-wrapper {
    padding: 0; /* Remove padding to let video touch edges */
    overflow: hidden;
}

.iframe-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Fixed 16:9 Aspect Ratio */
    height: 0;
    background-color: #000;
    border-bottom: 1px solid var(--border-light);
}

.iframe-container iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* --------------------------------------------------------------------------
   10. CIVIC SENSE & TIMELINE (Fixed Bullets & Overlaps)
-------------------------------------------------------------------------- */
.content-article {
    padding: var(--space-4) var(--space-5);
}

.lang-content {
    display: block; /* Override d-none manually handled in JS */
}

/* Custom Timeline Design (Replacing default ugly bullets) */
.timeline-item {
    position: relative;
    padding-left: var(--space-4);
    margin-bottom: var(--space-4);
    border-left: 2px solid var(--border-strong);
}

.timeline-item:last-child {
    border-left-color: transparent; /* Clean end */
}

.text-accent {
    position: relative;
    color: var(--text-primary);
}

/* Timeline Dot */
.timeline-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 6px;
    width: 12px; height: 12px;
    background-color: var(--bg-surface);
    border: 2px solid var(--text-primary);
    border-radius: 50%;
}

.action-box {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: var(--space-4);
    margin-top: var(--space-5);
}

/* Custom List Styles */
.custom-list {
    list-style: none; /* Hide default bullets */
}
.custom-list li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 12px;
}
.custom-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: -2px;
    color: var(--success-green);
    font-weight: 900;
    font-size: 1.1rem;
}

/* --------------------------------------------------------------------------
   11. NEWS GRID & CARDS
-------------------------------------------------------------------------- */
.news-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-surface);
}

.news-image {
    position: relative;
    width: 100%;
    height: 180px; /* Bigger image area */
    background-color: var(--bg-surface-hover);
    overflow: hidden;
}

.news-image img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.news-card:hover .news-image img { transform: scale(1.05); }

.news-badge {
    position: absolute;
    top: 12px; left: 12px;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 6px 10px;
    border-radius: 6px;
    letter-spacing: 0.05em;
    z-index: 2;
}
.news-badge.critical { background-color: var(--danger-red); color: #fff; }
.news-badge.live { background-color: var(--success-green); color: #fff; }
.news-badge.info { background-color: var(--neon-blue); color: #fff; }

.news-content {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;  
    overflow: hidden;
    margin-bottom: auto; /* Pushes the link to bottom */
}

.news-link {
    display: inline-block;
    margin-top: var(--space-3);
    text-decoration: none;
    transition: color var(--transition-fast);
}
.news-link:hover { color: var(--text-secondary); }

/* --------------------------------------------------------------------------
   12. ULTRA PREMIUM CLOCK TIMER
-------------------------------------------------------------------------- */
.timer-section {
    padding: var(--space-6) 0;
    background-color: var(--bg-base); /* Solid background, no lag */
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    margin-top: var(--space-7);
}

.timer-glass-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: 32px;
    box-shadow: var(--shadow-sm);
}

.clock-display {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    /* Wrap to avoid squeezing on small screens */
    flex-wrap: wrap; 
}

.time-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-light);
    padding: 16px clamp(10px, 2vw, 24px);
    border-radius: 16px;
    min-width: clamp(70px, 15vw, 100px);
}

.time-value {
    font-size: clamp(1.8rem, 5vw, 3rem); /* Huge legible numbers */
    line-height: 1;
    color: var(--text-primary);
}

.time-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-top: 8px;
    letter-spacing: 0.1em;
}

.time-colon {
    font-size: clamp(1.8rem, 5vw, 3rem);
    color: var(--text-tertiary);
    font-weight: 300;
}

/* --------------------------------------------------------------------------
   13. ONBOARDING MODAL
-------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: rgba(0, 0, 0, 0.9); /* Solid dark instead of heavy blur */
    z-index: 99999;
    padding: var(--space-4);
    display: flex; align-items: center; justify-content: center;
    opacity: 1;
    transition: opacity var(--transition-smooth);
}
.modal-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.onboarding-card {
    width: 100%;
    max-width: 420px;
    padding: var(--space-6) var(--space-4);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: 32px;
    transform: scale(1);
    transition: transform var(--transition-smooth);
}
.modal-overlay.fade-out .onboarding-card {
    transform: scale(0.95);
}

.icon-glow-box {
    width: 72px; height: 72px;
    border-radius: 24px;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-light);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

/* --------------------------------------------------------------------------
   14. FOOTER
-------------------------------------------------------------------------- */
.app-footer {
    padding: var(--space-7) 0 var(--space-5) 0;
    background-color: var(--bg-base);
}

.footer-links a {
    text-decoration: none;
    transition: color var(--transition-fast);
}
.footer-links a:hover {
    color: var(--text-primary);
}

.divider {
    width: 40px;
    height: 4px;
    background-color: var(--border-strong);
    margin: 0 auto;
    border-radius: 10px;
}

/* --------------------------------------------------------------------------
   15. RESPONSIVE / MOBILE FIXES (MEDIA QUERIES)
-------------------------------------------------------------------------- */
@media (max-width: 600px) {
    /* Navbar compacting */
    .floating-navbar {
        width: calc(100% - 24px);
        top: 12px;
        height: 54px;
        padding: 0 var(--space-2);
    }
    .profile-btn span { display: none; } /* Hide text on mobile */
    .profile-btn { padding: 4px; border-radius: 50%; }
    
    /* Spacing adjustments */
    .section { margin-top: var(--space-5); margin-bottom: var(--space-5); }
    .content-article { padding: var(--space-3); }
    .glass-card { border-radius: 16px; }
    
    /* Hide seconds or colons in clock on very small screens to prevent overflow */
    .hide-mobile { display: none !important; }
    .time-block { padding: 12px 16px; min-width: 65px; }
}

@media (max-width: 360px) {
    /* Fix for extremely narrow phones (e.g. iPhone SE) */
    .grid-2-col { grid-template-columns: 1fr; }
    .btn-vote { padding: 14px; font-size: 0.85rem; }
    .time-value { font-size: 1.5rem; }
}

/* --------------------------------------------------------------------------
   16. UTILITY ANIMATIONS (Optimized)
-------------------------------------------------------------------------- */
.fade-in {
    animation: fadeIn var(--transition-smooth) forwards;
}

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