/* ================================================================
   Election Guide Assistant - Styles
   ================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 9999;
    background: #0f172a;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
}

.skip-link:focus {
    left: 8px;
}

:root {
    --primary-blue: #2563eb;
    --primary-dark: #0b1220;
    --accent-orange: #f97316;
    --success-green: #10b981;
    --error-red: #ef4444;
    --warning-yellow: #f59e0b;
    --neutral-gray: #5b677b;
    --light-gray: #f7f9fc;
    --lighter-gray: #e2e8f0;
    --white: #ffffff;
    --border-radius: 14px;
    --transition: all 0.25s ease;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: radial-gradient(circle at top left, #dbeafe 0%, #eff6ff 32%, #f8fafc 100%);
    color: var(--primary-dark);
    overflow: hidden;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid #0f62fe;
    outline-offset: 2px;
}

/* ================================================================
   Layout
   ================================================================ */

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: transparent;
}

.app-shell {
    display: none;
    height: 100%;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.app-shell.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
}

.landing-page {
    min-height: 100vh;
    overflow-y: auto;
    padding: 22px;
    max-width: 1080px;
    margin: 0 auto;
    width: 100%;
}

.landing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
}

.landing-brand {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.landing-ghost-btn,
.landing-primary-btn,
.landing-secondary-btn {
    border-radius: 999px;
    padding: 10px 16px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.landing-ghost-btn {
    border-color: #cbd5e1;
    background: #ffffff;
    color: #1e293b;
}

.landing-ghost-btn:hover {
    border-color: #1d4ed8;
    color: #1d4ed8;
}

.hero-section {
    background: linear-gradient(145deg, #ffffff, #f8fbff);
    border: 1px solid #dbe7ff;
    border-radius: 18px;
    padding: 34px;
    margin-bottom: 20px;
}

.hero-badge {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 12px;
    letter-spacing: 0.7px;
    font-weight: 700;
    color: #1d4ed8;
    text-transform: uppercase;
}

.hero-section h1 {
    font-size: 38px;
    line-height: 1.15;
    margin-bottom: 10px;
}

.hero-subtitle {
    font-size: 18px;
    color: #334155;
    margin-bottom: 12px;
}

.hero-copy {
    color: #475569;
    font-size: 15px;
    line-height: 1.6;
    max-width: 690px;
}

.hero-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.landing-primary-btn {
    background: #1d4ed8;
    color: #fff;
}

.landing-primary-btn:hover {
    background: #1e3a8a;
    transform: translateY(-1px);
}

.landing-secondary-btn {
    background: #fff;
    border-color: #cbd5e1;
    color: #1e293b;
}

.landing-secondary-btn:hover {
    border-color: #1d4ed8;
    color: #1d4ed8;
}

.landing-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 26px;
    margin-bottom: 14px;
}

.landing-section h2 {
    font-size: 25px;
    margin-bottom: 16px;
}

.feature-grid,
.how-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.feature-card,
.how-step-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    transition: var(--transition);
}

.feature-card:hover,
.how-step-card:hover {
    border-color: #93c5fd;
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 20px;
    margin-bottom: 8px;
}

.feature-card h3,
.how-step-card h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.feature-card p,
.how-step-card p {
    font-size: 13px;
    color: #475569;
    line-height: 1.45;
}

.how-step-number {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 10px;
}

.trust-section p {
    color: #475569;
    line-height: 1.6;
}

.trust-links {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.trust-links a {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #1d4ed8;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.landing-cta {
    background: linear-gradient(145deg, #0f172a, #1e3a8a);
    color: #fff;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 16px;
    text-align: center;
}

.landing-cta h2 {
    margin-bottom: 8px;
}

.landing-cta p {
    opacity: 0.9;
    margin-bottom: 14px;
}

.landing-footer {
    text-align: center;
    color: #475569;
    font-size: 13px;
    padding-bottom: 24px;
}

.fade-up {
    animation: fadeUp 0.55s ease both;
}

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

.header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: white;
    padding: 14px 24px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.08);
}

.logo-text h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
}

.logo-text .subtitle {
    font-size: 13px;
    opacity: 0.82;
    margin: 2px 0 0 0;
}

.language-toggle {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}

.language-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ================================================================
   Main Layout
   ================================================================ */

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    max-width: 1320px;
    margin: 0 auto;
    width: 100%;
    gap: 16px;
    padding: 20px;
}

.sidebar {
    width: 280px;
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    overflow-y: auto;
    flex-shrink: 0;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

/* ================================================================
   Sidebar Components
   ================================================================ */

.section-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-dark);
    margin-bottom: 16px;
    opacity: 0.7;
}

.welcome-panel {
    margin: 16px;
    padding: 18px 18px 16px;
    border: 1px solid #dbe7ff;
    background: linear-gradient(140deg, #eff6ff 0%, #f8fbff 100%);
    border-radius: 12px;
}

.welcome-eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #1d4ed8;
    font-weight: 700;
    margin-bottom: 8px;
}

.welcome-panel h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.welcome-copy {
    color: var(--neutral-gray);
    font-size: 14px;
    line-height: 1.5;
}

.welcome-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.welcome-cta {
    padding: 8px 12px;
    background: var(--light-gray);
    border: 1px solid var(--lighter-gray);
    border-radius: 999px;
    font-size: 12px;
    color: var(--primary-blue);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.welcome-cta:hover {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.welcome-cta.strong {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
}

.welcome-cta.strong:hover {
    background: #1e3a8a;
    border-color: #1e3a8a;
}

/* Progress Tracker */
.progress-section {
    margin-bottom: 30px;
}

.progress-tracker {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--neutral-gray);
}

.progress-step.completed {
    color: var(--success-green);
}

.progress-step.active {
    color: var(--primary-blue);
    font-weight: 600;
}

.progress-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    background: var(--light-gray);
    color: var(--primary-dark);
}

.progress-step.completed .progress-dot {
    background: var(--success-green);
    color: white;
}

.progress-step.active .progress-dot {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.1);
}

.progress-bar {
    width: 2px;
    height: 20px;
    background: var(--lighter-gray);
    margin-left: 15px;
}

/* Timeline */
.timeline-section {
    border-top: 1px solid var(--lighter-gray);
    padding-top: 20px;
}

.timeline {
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--lighter-gray);
}

.timeline-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    position: relative;
}

.timeline-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 700;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.timeline-content {
    flex: 1;
    padding-top: 2px;
}

.timeline-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 2px;
}

.timeline-label {
    font-size: 12px;
    color: var(--neutral-gray);
}

/* Quick Links */
.quick-links-section {
    border-top: 1px solid var(--lighter-gray);
    padding-top: 20px;
}

.quick-link {
    display: block;
    padding: 10px 12px;
    background: var(--light-gray);
    border-radius: 8px;
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.quick-link:hover {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

/* ================================================================
   Chat Area
   ================================================================ */

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

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

.message.user {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 78%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
}

.message.assistant .message-bubble {
    background: #f8fafc;
    color: var(--primary-dark);
    border-left: 3px solid var(--primary-blue);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: white;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.message.assistant .message-time {
    color: var(--neutral-gray);
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Typing Indicator */
.typing-bubble {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--light-gray);
    border-radius: 12px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neutral-gray);
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

/* ================================================================
   Input Area
   ================================================================ */

.input-area {
    background: white;
    border-top: 1px solid var(--lighter-gray);
    padding: 14px 16px 16px;
    flex-shrink: 0;
}

.message-form {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.message-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.send-button {
    padding: 12px 20px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.send-button:hover {
    background: #1e3a8a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.send-button:active {
    transform: translateY(0);
}

.send-icon {
    font-size: 16px;
}

/* Hint Buttons */
.input-hints {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hint-button {
    padding: 8px 12px;
    background: var(--light-gray);
    border: 1px solid var(--lighter-gray);
    border-radius: 999px;
    font-size: 12px;
    color: var(--primary-blue);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.hint-button:hover {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}


/* ================================================================
   Modals
   ================================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.infoform-modal {
    max-width: 400px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--neutral-gray);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--primary-dark);
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 20px;
    margin-right: 20px;
}

.modal-footer {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ================================================================
   Checklist
   ================================================================ */

.checklist {
    margin-bottom: 20px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--light-gray);
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 14px;
}

.checklist-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--lighter-gray);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.checklist-item.checked .checklist-checkbox {
    background: var(--success-green);
    border-color: var(--success-green);
    color: white;
}

.checklist-item.checked {
    background: rgba(16, 185, 129, 0.1);
}

.checklist-item.checked .checklist-text {
    opacity: 0.7;
    text-decoration: line-through;
}

/* ================================================================
   Forms
   ================================================================ */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--primary-dark);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--lighter-gray);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* ================================================================
   Buttons
   ================================================================ */

.btn-primary {
    padding: 10px 20px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.btn-primary:hover {
    background: #1e3a8a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ================================================================
   Utility Classes
   ================================================================ */

.success-text {
    color: var(--success-green);
    font-weight: 600;
}

.error-text {
    color: var(--error-red);
}

.warning-text {
    color: var(--warning-yellow);
}

.highlight {
    background: rgba(245, 158, 11, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ================================================================
   Responsive Design
   ================================================================ */

@media (max-width: 1024px) {
    .main-content {
        gap: 12px;
        padding: 12px;
    }

    .sidebar {
        width: 240px;
        padding: 16px;
    }

    .message-bubble {
        max-width: 80%;
    }
}

@media (max-width: 768px) {
    .landing-page {
        padding: 14px;
    }

    .hero-section {
        padding: 22px;
    }

    .hero-section h1 {
        font-size: 30px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .feature-grid,
    .how-grid {
        grid-template-columns: 1fr;
    }

    .container {
        height: 100vh;
    }

    .header-content {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .logo-text h1 {
        font-size: 20px;
    }

    .language-toggle {
        align-self: flex-end;
    }

    .main-content {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    .sidebar {
        width: 100%;
        border-radius: 0;
        max-height: 220px;
        overflow-x: auto;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
        padding: 14px 12px;
    }

    .sidebar > * {
        border-right: 1px solid var(--lighter-gray);
    }

    .sidebar > *:last-child {
        border-right: none;
    }

    .chat-area {
        border-radius: 0;
        flex: 1;
    }

    .message-bubble {
        max-width: 85%;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .messages-container { padding: 8px 12px 16px; }

    .input-area {
        padding: 12px;
    }

    .input-hints {
        max-height: 40px;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .landing-header {
        gap: 10px;
    }

    .landing-ghost-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .logo {
        gap: 8px;
    }

    .logo-icon {
        font-size: 11px;
        padding: 5px 10px;
    }

    .logo-text h1 {
        font-size: 18px;
    }

    .sidebar {
        grid-template-columns: 1fr;
        max-height: none;
        gap: 12px;
    }

    .sidebar > * {
        border-right: none;
        border-bottom: 1px solid var(--lighter-gray);
        padding-bottom: 12px;
    }

    .sidebar > *:last-child {
        border-bottom: none;
    }

    .message-form {
        flex-direction: column;
    }

    .send-button {
        width: 100%;
    }

    .message-bubble {
        max-width: 90%;
    }

    .welcome-panel {
        margin: 10px;
        padding: 14px;
    }

    .welcome-panel h2 {
        font-size: 20px;
    }

    .modal-content {
        width: 98%;
    }
}

/* ================================================================
   Scrollbar Styling
   ================================================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--lighter-gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-gray);
}

/* ================================================================
   Print Styles
   ================================================================ */

@media print {
    .header,
    .sidebar,
    .input-area,
    .send-button {
        display: none;
    }

    .chat-area {
        box-shadow: none;
    }
}
