/* Container & Background */
.naca-sentinel-v2 {
    background-color: #002147;
    background-image: radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    padding: 80px 20px;
    color: #ffffff;
    font-family: 'Inter', -apple-system, sans-serif;
}
.naca-container { max-width: 900px; margin: 0 auto; }

/* Red/White/Blue Divider */
.sentinel-divider { display: flex; justify-content: center; margin-bottom: 25px; }
.sentinel-divider span { width: 100px; height: 4px; background: linear-gradient(to right, #bf0a30 33%, #ffffff 33%, #ffffff 66%, #002868 66%); border-radius: 2px; }

/* Typography */
.sentinel-title { font-size: 3.2rem; font-weight: 800; margin-bottom: 10px; letter-spacing: -1px; text-align: center; color: white;}
.sentinel-subtitle { font-size: 1.2rem; font-weight: 400; opacity: 0.9; margin-bottom: 40px; text-align: center; }

/* Rounded Search Bar */
.sentinel-search-container { 
    max-width: 800px; 
    margin: 0 auto 30px auto; 
    width: 100%; 
    box-sizing: border-box; 
}

.search-inner { 
    background: #ffffff; 
    border-radius: 30px; 
    display: flex; 
    align-items: center; 
    padding: 8px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); 
    box-sizing: border-box;
    width: 100%; 
    flex-wrap: wrap; 
    gap: 10px; 
}

.search-icon { padding: 0 20px; color: #888; font-size: 1.2rem; }

.search-inner input { 
    flex: 1 1 200px; 
    min-width: 0; 
    border: none !important; 
    outline: none !important; 
    padding: 10px; 
    font-size: 1.1rem; 
    color: #333; 
    background: transparent; 
}

.search-inner button { 
    background: #bf0a30; 
    color: #fff; 
    border: none; 
    padding: 15px 25px; 
    border-radius: 50px; 
    font-weight: 700; 
    font-size: 1rem; 
    cursor: pointer; 
    flex: 1 1 auto; 
    text-align: center;
    transition: background 0.3s; 
}

.search-inner button:hover { background: #e60000; }

/* Pill Badges */
.sentinel-badges { 
    display: flex; 
    justify-content: center; 
    gap: 15px; 
    margin-bottom: 40px; 
    flex-wrap: wrap; 
}

.pill-badge { 
    padding: 8px 20px; 
    border-radius: 30px; 
    font-size: 0.85rem; 
    font-weight: 600; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    user-select: none; 
    white-space: nowrap; 
}

.pill-badge:hover { transform: translateY(-3px); filter: brightness(1.2); box-shadow: 0 5px 15px rgba(0,0,0,0.4); }
.pill-badge.blue { background: rgba(59, 89, 152, 0.3); border: 1px solid rgba(255,255,255,0.2); color: white;}
.pill-badge.red { background: rgba(191, 10, 48, 0.4); border: 1px solid rgba(191, 10, 48, 0.8); position: relative; color: white;}
.pill-badge.green { background: rgba(0, 128, 0, 0.2); border: 1px solid rgba(0, 128, 0, 0.5); color: #4ade80; }

.pill-badge.red::before { content: "⚡"; margin-right: 5px; animation: pulse-icon 1.5s infinite; }
.pill-badge.red.pulse { animation: pulse-glow 2s infinite ease-in-out; }

/* Dynamic Active Alert States */
.pill-badge.red.active-alert { 
    animation: urgent-alert 1.2s infinite ease-in-out !important; 
    background: rgba(191, 10, 48, 0.9) !important;
    border-color: #ffd700 !important; 
    color: #fff !important;
    transform: translateY(-3px);
}

.pill-badge.green.active-alert,
.pill-badge.blue.active-alert {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    filter: brightness(1.2);
}

@keyframes pulse-icon { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.2); } 100% { opacity: 1; transform: scale(1); } }
@keyframes pulse-glow { 0% { box-shadow: 0 0 0 0 rgba(191, 10, 48, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(191, 10, 48, 0); } 100% { box-shadow: 0 0 0 0 rgba(191, 10, 48, 0); } }
@keyframes urgent-alert { 
    0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); transform: scale(1) translateY(-3px); } 
    50% { transform: scale(1.05) translateY(-3px); }
    70% { box-shadow: 0 0 0 15px rgba(255, 215, 0, 0); } 
    100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); transform: scale(1) translateY(-3px); } 
}

/* Results & Flash Banner */
.naca-alert-banner { background: #bf0a30; color: #fff; padding: 15px; text-align: center; font-weight: 800; font-size: 1.1rem; border-radius: 8px; margin-bottom: 25px; border: 2px solid #ffd700; }
.flash-alert { animation: alert-border 2s infinite; }
@keyframes alert-border { 0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); } 70% { box-shadow: 0 0 0 15px rgba(255, 215, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); } }
.filter-header { background: rgba(255,215,0,0.1); border-left: 4px solid #ffd700; padding: 15px; margin-bottom: 20px; font-weight: bold; color: #ffd700; text-transform: uppercase; letter-spacing: 1px; }

/* Rich Candidate Cards */
.contest-title { color: #fff; border-bottom: 2px solid rgba(255,255,255,0.2); padding-bottom: 10px; margin-top: 40px; }
.rich-candidate-card { background: #fff; border-radius: 15px; overflow: hidden; margin-bottom: 25px; box-shadow: 0 15px 35px rgba(0,0,0,0.1); color: #1a1a1a; }
.card-header-flex { display: flex; align-items: center; padding: 20px 25px; background: #ffffff; gap: 20px; border-bottom: 1px solid #eee; }

/* Photo Styling */
.card-photo-wrapper { flex-shrink: 0; }
.naca-candidate-img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid #002868; box-shadow: 0 4px 10px rgba(0,0,0,0.1); background: #f8f9fa; display: block; }
.naca-candidate-img.placeholder { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #e0e4e8 0%, #cbd2d9 100%); border: 3px solid #cbd2d9; }
.placeholder-icon { font-size: 2.5rem; color: #ffffff; opacity: 0.8; }

/* Titles & Badges */
.card-title-wrapper h3 { margin: 5px 0 0 0; font-size: 1.5rem; color: #1a1a1a; font-weight: 800; }
.party-tag { font-size: 1rem; color: #666; font-weight: 400; }
.vision-badge { padding: 4px 10px; border-radius: 4px; font-weight: 800; font-size: 0.7rem; text-transform: uppercase; display: inline-block; }
.badge-closed { background: #ffd700; color: #001529; }
.badge-open { background: #444; color: #fff; }
.badge-neutral { background: #eee; color: #888; }

/* Tabs */
.card-tabs { display: flex; background: #f1f4f8; border-bottom: 1px solid #ddd; }
.tab-btn { flex: 1; padding: 15px; border: none; background: none; cursor: pointer; font-weight: 700; color: #666; transition: 0.3s; }
.tab-btn.active { background: #fff; color: #bf0a30; border-top: 3px solid #bf0a30; }
.tab-btn:hover:not(.active) { background: #e2e8f0; }
.tab-content { display: none; padding: 25px; line-height: 1.6; color: #333; }
.tab-content.active { display: block; animation: fadeInTab 0.3s ease; }

@keyframes fadeInTab { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }


/* ==========================================================================
   Mobile Responsive Adjustments (Hardened for iPhone)
   ========================================================================== */

/* Fix the browser autofill turning the input blue */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active{
    -webkit-box-shadow: 0 0 0 30px white inset !important;
}

@media (max-width: 850px) {
    .naca-sentinel-v2 { padding: 40px 10px; }
    .sentinel-title { font-size: 2.2rem; }
    .sentinel-subtitle { font-size: 1rem; }

    /* Force the Search Bar to stack cleanly on iPhones */
    .search-inner { 
        flex-direction: column !important; 
        background: transparent !important; 
        box-shadow: none !important;
        padding: 0 !important;
        gap: 12px !important; 
    }
    
    .search-icon { display: none !important; }
    
    .search-inner input { 
        width: 100% !important; 
        background: #ffffff !important; 
        text-align: center !important; 
        font-size: 16px !important; 
        padding: 18px 20px !important; 
        border-radius: 50px !important;
        box-shadow: 0 10px 20px rgba(0,0,0,0.2) !important;
    }
    
    .search-inner button { 
        width: 100% !important; 
        border-radius: 50px !important; 
        padding: 18px !important; 
        white-space: normal !important; 
        box-shadow: 0 10px 20px rgba(0,0,0,0.2) !important;
    }

    /* Force Badges to wrap and scale */
    .sentinel-badges {
        flex-wrap: wrap !important;
    }
    .pill-badge { 
        flex: 1 1 100% !important; 
        text-align: center !important; 
        margin-bottom: 5px;
    }

    /* Header stacking for candidate cards */
    .card-header-flex { flex-direction: column !important; text-align: center !important; padding: 25px !important; }
    .naca-candidate-img { width: 100px !important; height: 100px !important; margin: 0 auto !important; }
    .tab-btn { font-size: 0.8rem !important; padding: 12px 5px !important; }
}