/* ===================================================================
   Grievance Portal — Mobile-First Styles
   Indian Tricolour Theme:
   • Saffron (केसरिया): #FF9933 / #E66A00
   • White (श्वेत): #FFFFFF / #FFFDF9
   • India Green (हरा): #138808 / #0D6A05
   • Navy Blue Accent (चक्र): #0C1A38
   =================================================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* ── Tricolour Palette ── */
    --saffron: #FF9933;
    --saffron-vibrant: #FF7700;
    --saffron-dark: #D95A00;
    --saffron-light: #FFF4E5;
    --saffron-glow: rgba(255, 153, 51, 0.28);

    --white: #FFFFFF;
    --cream: #FFFDF9;

    --green: #138808;
    --green-dark: #0B6405;
    --green-light: #EBF7EB;
    --green-glow: rgba(19, 136, 8, 0.25);

    --navy: #0C1A38;
    --text-primary: #1C1E24;
    --text-secondary: #4A4E5A;
    --text-muted: #787D8A;
    --red: #D32F2F;

    /* ── Layout & UI ── */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 8px 24px rgba(12, 26, 56, 0.12);
    --shadow-saffron: 0 6px 20px rgba(255, 119, 0, 0.38);
    --shadow-green: 0 6px 20px rgba(19, 136, 8, 0.35);
    --transition: 0.22s ease;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Noto Sans Devanagari', 'Devanagari Sangam MN', 'Nirmala UI', 'Mangal', system-ui, -apple-system, sans-serif;
    background-color: var(--cream);
    background-image: radial-gradient(circle at 50% 0%, rgba(255, 153, 51, 0.08) 0%, transparent 60%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- App Container ---------- */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    max-width: 540px;
    margin: 0 auto;
    background: #FFFFFF;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.06);
    position: relative;
}

/* ── National Tricolour Stripes ── */
.tricolour-header,
.tricolour-footer {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex-shrink: 0;
}

.tri-stripe {
    width: 100%;
}

.tri-saffron {
    height: 6px;
    background: linear-gradient(90deg, #FF9933, #FF7700, #FF9933);
}

.tri-white {
    height: 4px;
    background: #FFFFFF;
}

.tri-green {
    height: 6px;
    background: linear-gradient(90deg, #138808, #18A80A, #138808);
}

/* ── Top Campaign Header Strip ── */
.top-campaign-banner {
    width: 100%;
    background: #FFFFFF;
    border-bottom: 2px solid var(--saffron-light);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6px 12px;
}

.campaign-banner-img {
    width: 100%;
    height: auto;
    max-height: 58px;
    object-fit: contain;
    display: block;
}

/* ---------- Screens ---------- */
.screen {
    display: none;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: 16px 16px 28px;
}

.screen.active {
    display: flex;
}

.screen-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

/* =======================================================
   SCREEN 1: LANDING & HERO
   ======================================================= */

/* ── Main Candidate Poster ── */
.poster-card {
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000000;
    border: 2.5px solid var(--saffron);
    box-shadow: var(--shadow-card);
    margin-bottom: 16px;
    position: relative;
}

.poster-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* ── Hero Headline ── */
.hero-text-block {
    margin-bottom: 12px;
    padding: 0 8px;
}

.heading {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.35;
    margin-bottom: 6px;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* ── Tricolour Divider ── */
.tri-divider {
    width: 90px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--saffron) 0%, #FFFFFF 50%, var(--green) 100%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    margin: 4px 0 16px;
}

/* ── Mic Container & Button ── */
.mic-container {
    position: relative;
    width: 104px;
    height: 104px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 6px 0 12px;
}

.mic-btn {
    width: 88px;
    height: 88px;
    border-radius: var(--radius-full);
    border: none;
    background: linear-gradient(135deg, var(--saffron-vibrant) 0%, var(--saffron-dark) 100%);
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-saffron);
    position: relative;
    z-index: 2;
    transition: transform var(--transition), box-shadow var(--transition);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mic-glow {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-full);
    background: var(--saffron);
    opacity: 0.25;
    animation: mic-pulse 2.2s infinite ease-out;
    z-index: 1;
}

@keyframes mic-pulse {
    0% { transform: scale(0.9); opacity: 0.4; }
    50% { transform: scale(1.18); opacity: 0.15; }
    100% { transform: scale(1.3); opacity: 0; }
}

.mic-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 26px rgba(255, 119, 0, 0.48);
}

.mic-btn:active {
    transform: scale(0.95);
}

.instruction {
    font-size: 1.05rem;
    color: var(--saffron-dark);
    font-weight: 700;
    margin-bottom: 2px;
}

.lang-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* =======================================================
   SCREEN 2: RECORDING
   ======================================================= */
#screen-recording {
    background: linear-gradient(180deg, #FFF6F6 0%, #FFFFFF 100%);
}

.recording-badge {
    background: #FFEBEE;
    color: var(--red);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(211, 47, 47, 0.2);
    margin-bottom: 16px;
}

.recording-visual {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.rec-center-mic {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 3;
    box-shadow: 0 4px 16px rgba(211, 47, 47, 0.4);
}

.pulse-ring {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    border: 2.5px solid var(--red);
    opacity: 0;
    animation: ripple 2s cubic-bezier(0.1, 0.2, 0.3, 1) infinite;
    z-index: 1;
}

.pulse-2 { animation-delay: 0.6s; }
.pulse-3 { animation-delay: 1.2s; }

@keyframes ripple {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.2); opacity: 0; }
}

.timer {
    font-size: 3rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    letter-spacing: 2px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    margin-bottom: 4px;
}

.rec-label {
    font-size: 1.05rem;
    color: var(--red);
    font-weight: 600;
    margin-bottom: 2px;
}

.rec-limit {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.stop-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 34px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--red);
    color: var(--white);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(211, 47, 47, 0.35);
    transition: transform var(--transition), background var(--transition);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    font-family: inherit;
}

.stop-btn:active {
    transform: scale(0.96);
    background: #B71C1C;
}

/* =======================================================
   SCREEN 3: PREVIEW & SUBMISSION
   ======================================================= */
#screen-preview {
    background: linear-gradient(180deg, var(--saffron-light) 0%, #FFFFFF 40%);
}

.preview-badge {
    background: #E8F5E9;
    color: var(--green);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(19, 136, 8, 0.2);
    margin-bottom: 12px;
}

.preview-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 18px;
}

.player-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--white);
    border: 2px solid var(--saffron);
    border-radius: var(--radius-lg);
    padding: 16px;
    width: 100%;
    box-shadow: var(--shadow-card);
}

.play-btn {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: var(--radius-full);
    border: none;
    background: linear-gradient(135deg, var(--saffron-vibrant), var(--saffron-dark));
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: var(--shadow-saffron);
}

.play-btn:active {
    transform: scale(0.93);
}

.progress-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: #ECEFF1;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    touch-action: manipulation;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--saffron), var(--green));
    border-radius: 4px;
    width: 0%;
    transition: width 0.08s linear;
}

.time-readout {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.playback-time {
    font-weight: 600;
    color: var(--navy);
}

.rec-meta {
    margin: 12px 0 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.rec-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #F4F6F8;
    padding: 6px 14px;
    border-radius: var(--radius-full);
}

.rec-meta svg {
    color: var(--saffron-dark);
}

.preview-actions {
    display: flex;
    gap: 12px;
    width: 100%;
}

/* ---------- Common Button Styles ---------- */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    border: none;
    font-family: inherit;
    flex: 1;
}

.btn:active {
    transform: scale(0.97);
}

.btn-outline {
    background: #FFFFFF;
    color: var(--text-secondary);
    border: 2px solid #DCE1E7;
}

.btn-outline:hover {
    border-color: var(--saffron);
    color: var(--saffron-dark);
    background: var(--saffron-light);
}

.btn-submit {
    background: linear-gradient(135deg, #138808 0%, #0D6A05 100%);
    color: #FFFFFF;
    box-shadow: var(--shadow-green);
}

.btn-submit:hover {
    background: #0B6405;
    box-shadow: 0 8px 24px rgba(19, 136, 8, 0.45);
}

.btn-primary {
    background: linear-gradient(135deg, var(--saffron-vibrant) 0%, var(--saffron-dark) 100%);
    color: #FFFFFF;
    box-shadow: var(--shadow-saffron);
}

/* =======================================================
   SCREEN 4: SUBMITTING / UPLOADING
   ======================================================= */
#screen-submitting {
    background: linear-gradient(180deg, var(--saffron-light) 0%, #FFFFFF 60%);
}

.upload-icon {
    margin-bottom: 18px;
}

.spin-slow {
    animation: spin 2.4s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.upload-label {
    font-size: 1.05rem;
    color: var(--navy);
    font-weight: 600;
    margin-bottom: 16px;
}

.upload-bar-track {
    width: 100%;
    max-width: 280px;
    height: 10px;
    background: #E8ECEF;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.upload-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--saffron), var(--green));
    border-radius: 5px;
    width: 0%;
    transition: width 0.25s ease;
}

.upload-percent {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--green);
    margin-top: 10px;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* =======================================================
   SCREEN 5: SUCCESS
   ======================================================= */
#screen-success {
    background: linear-gradient(180deg, var(--green-light) 0%, #FFFFFF 50%);
}

.success-badge {
    margin-bottom: 16px;
}

.success-msg {
    font-size: 1.25rem;
    color: var(--green-dark);
    line-height: 1.6;
    margin-bottom: 14px;
    font-weight: 700;
}

.candidate-tag {
    font-size: 0.95rem;
    color: var(--saffron-dark);
    font-weight: 600;
    margin-bottom: 28px;
    background: var(--saffron-light);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    border: 1px dashed var(--saffron);
}

/* =======================================================
   SCREEN 6 & 7: ERROR & UNSUPPORTED
   ======================================================= */
.error-badge {
    margin-bottom: 16px;
}

.error-msg {
    font-size: 1.1rem;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 8px;
    font-weight: 600;
}

.error-detail {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

#screen-error .btn,
#screen-success .btn {
    max-width: 280px;
}

/* ---------- Utility ---------- */
.hidden {
    display: none !important;
}

/* ---------- Responsive Adjustments ---------- */
@media (min-width: 480px) {
    .heading {
        font-size: 1.7rem;
    }
    .poster-card {
        border-radius: var(--radius-lg);
    }
    .screen {
        padding: 24px 24px 36px;
    }
}

/* Reduce motion accessibility */
@media (prefers-reduced-motion: reduce) {
    .mic-glow { animation: none; }
    .pulse-ring { animation: none; }
    .spin-slow { animation: none; }
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
    }
}
