/* ============================================================
   AD COMPASS - SHARED STYLES
   HIGHER CONTRAST FOR BETTER READABILITY
   ============================================================ */

/* ========== ROOT VARIABLES ========== */
:root {
    --navy-0: #05070D;
    --navy-1: #0B111E;
    --navy-2: #111A2B;
    --navy-line: #2A3A5A;
    --navy-hover: #1A2740;
    --gold: #C9A24A;
    --gold-2: #EACD84;
    --gold-dim: rgba(201, 162, 74, 0.15);
    --ivory: #F5F1E6;
    
    /* HIGHER CONTRAST TEXT COLORS */
    --text-primary: #F5F1E6;      /* Main text - bright ivory */
    --text-secondary: #D5CFC4;    /* Secondary text - lighter gray */
    --text-muted: #B8B0A0;        /* Muted text - much lighter than before */
    --text-dim: #9A9285;          /* Dim text - still readable */
    
    --slate: #B8B0A0;             /* Replaced #93A0B6 with lighter version */
    --slate-dim: #9A9285;         /* Replaced #545F78 with lighter version */
    --slate-dark: #6A655A;
    --danger: #E0897E;
    --success: #7BC9A4;
    
    --font-display: 'Fraunces', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    
    --radius: 4px;
    --radius-lg: 8px;
    --transition: 0.2s ease;
}

/* ========== RESET ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--navy-0);
    color: var(--text-primary);
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    -webkit-user-select: none;
    user-select: none;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Allow text selection in inputs */
input,
textarea,
.prompt-box,
.prompt-content,
.copy-area {
    -webkit-user-select: text;
    user-select: text;
}

::selection {
    background: var(--gold);
    color: var(--navy-0);
}

:focus-visible {
    outline: 2px solid var(--gold-2);
    outline-offset: 3px;
}

/* ========== BACKGROUND EFFECTS ========== */
.glow {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 900px;
    height: 900px;
    transform: translate(-50%, -58%);
    background: radial-gradient(circle, rgba(201, 162, 74, 0.08), transparent 65%);
    pointer-events: none;
    z-index: 0;
}

.grain {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(circle at 1px 1px, rgba(245, 241, 230, 0.03) 1px, transparent 0);
    background-size: 3px 3px;
}

/* ========== STAGE CONTAINER ========== */
.stage {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    text-align: center;
}

/* ========== BRAND ========== */
.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

.brand svg {
    display: block;
    flex-shrink: 0;
}

.brand-text {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--gold);
}

/* ========== PROGRESS ========== */
.progress-bar {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 24px;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--navy-line);
    transition: background 0.3s ease, transform 0.3s ease;
}

.progress-dot.active {
    background: var(--gold);
    transform: scale(1.2);
}

.progress-dot.done {
    background: var(--gold-dim);
}

/* ========== PAGE TYPOGRAPHY ========== */
.page-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(38px, 6vw, 52px);
    line-height: 1.05;
    letter-spacing: -1px;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.page-tagline {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(17px, 2.5vw, 24px);
    color: var(--gold);
    margin-bottom: 16px;
    text-align: center;
    letter-spacing: -0.3px;
}

.page-description {
    font-size: 17px;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 50ch;
    margin: 0 auto 28px;
    text-align: center;
}

.page-description strong {
    color: var(--text-primary);
    font-weight: 500;
}

/* ========== FIELD LABEL ========== */
.field-label {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 8px;
    text-align: left;
    display: block;
}

.optional-label {
    color: var(--text-muted);
    font-weight: 400;
    text-transform: none;
    font-family: var(--font-body);
    font-size: 13px;
    letter-spacing: 0;
}

/* ========== INPUTS ========== */
.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group input,
.input-group textarea {
    width: 100%;
    background: var(--navy-1);
    border: 1px solid var(--navy-line);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 17px;
    padding: 17px 20px;
    transition: border-color 0.2s ease, background 0.2s ease;
    text-align: left;
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: var(--text-dim);
}

.input-group input:focus,
.input-group textarea:focus {
    border-color: var(--gold);
    background: #0F1729;
    outline: none;
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.input-group .hint {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: left;
}

/* ========== BUTTONS ========== */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 16px;
    padding: 16px 28px;
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 54px;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: translateY(1px);
}

.btn svg {
    display: block;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--gold);
    color: var(--navy-0);
    flex: 2;
}

.btn-primary:hover {
    background: var(--gold-2);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    border-color: var(--navy-line);
    color: var(--text-secondary);
    flex: 1;
}

.btn-secondary:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text-secondary);
}

.btn-success {
    background: var(--success);
    color: var(--navy-0);
}

.btn-success:hover {
    background: #8FD4B0;
}

.actions {
    display: flex;
    gap: 14px;
    margin-top: 24px;
    justify-content: center;
}

/* ========== DIRECTION CARDS ========== */
.directions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 520px) {
    .directions-grid {
        grid-template-columns: 1fr;
    }
}

.direction-card {
    background: var(--navy-1);
    border: 1px solid var(--navy-line);
    border-radius: var(--radius-lg);
    padding: 18px 20px 16px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
    text-align: left;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.direction-card:hover {
    border-color: var(--slate-dark);
    background: var(--navy-2);
}

.direction-card:active {
    transform: scale(0.98);
}

.direction-card.selected {
    border-color: var(--gold);
    background: var(--gold-dim);
}

.direction-card .card-icon {
    font-size: 24px;
    margin-bottom: 6px;
    display: block;
}

.direction-card .card-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 17px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.direction-card .card-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
}

.direction-card .card-when {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.3;
}

.direction-card .card-example {
    font-size: 12.5px;
    color: var(--gold-2);
    margin-top: 6px;
    font-weight: 400;
    line-height: 1.3;
    opacity: 0.85;
}

.direction-card .check-mark {
    display: none;
    position: absolute;
    top: 12px;
    right: 14px;
    color: var(--gold);
    font-size: 18px;
}

.direction-card.selected .check-mark {
    display: block;
}

/* ========== CHANNEL GRID ========== */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

@media (max-width: 440px) {
    .channel-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.channel-tile {
    background: var(--navy-1);
    border: 1px solid var(--navy-line);
    border-radius: var(--radius);
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    -webkit-tap-highlight-color: transparent;
}

.channel-tile:hover {
    background: var(--navy-2);
    border-color: var(--slate-dark);
}

.channel-tile.selected {
    border-color: var(--gold);
    background: var(--gold-dim);
    color: var(--gold);
}

/* ========== OPTION PILLS (Goal & Action) ========== */
.option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.option-pill {
    background: var(--navy-1);
    border: 1px solid var(--navy-line);
    border-radius: 40px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.option-pill:hover {
    background: var(--navy-2);
    border-color: var(--slate-dark);
}

.option-pill.selected {
    border-color: var(--gold);
    background: var(--gold-dim);
    color: var(--gold);
}

/* ========== DIRECTION CONFIRMATION BANNER ========== */
.direction-confirm {
    background: var(--gold-dim);
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 500;
    color: var(--gold-2);
    font-size: 15px;
    flex-wrap: wrap;
}

.direction-confirm .label {
    font-weight: 400;
    color: var(--text-secondary);
}

/* ========== SUGGESTION BANNER ========== */
.suggestion-banner {
    background: rgba(224, 137, 126, 0.10);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    text-align: left;
}

.suggestion-banner .suggestion-title {
    font-weight: 600;
    color: var(--danger);
    margin-bottom: 4px;
}

.suggestion-banner .suggestion-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.suggestion-banner .suggestion-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.suggestion-banner .suggestion-actions .btn {
    padding: 10px 20px;
    font-size: 13px;
    min-height: 40px;
}

/* ========== REFINE SCREEN - INTERNAL OPTIONS ========== */
.internal-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    text-align: left;
}

.internal-option {
    background: var(--navy-1);
    border: 1px solid var(--navy-line);
    border-radius: var(--radius);
    padding: 14px 18px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

.internal-option:hover {
    background: var(--navy-2);
    border-color: var(--slate-dark);
}

.internal-option.selected {
    border-color: var(--gold);
    background: var(--gold-dim);
}

.internal-option .option-label {
    font-weight: 500;
    color: var(--text-primary);
}

.internal-option .option-badge {
    font-size: 11px;
    font-weight: 500;
    color: var(--gold);
    background: var(--gold-dim);
    padding: 2px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.internal-option .option-badge.recommended {
    background: var(--gold);
    color: var(--navy-0);
}

.internal-option .option-badge.secondary {
    background: var(--navy-line);
    color: var(--text-secondary);
}

.internal-option .option-badge.fallback {
    background: var(--slate-dark);
    color: var(--text-primary);
}

.internal-option .option-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ========== FINAL SCREEN ========== */
.strategy-summary {
    background: var(--navy-1);
    border: 1px solid var(--navy-line);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 20px;
    text-align: left;
}

.strategy-summary .item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.strategy-summary .item:last-child {
    border-bottom: none;
}

.strategy-summary .item .label-sm {
    color: var(--text-muted);
    font-weight: 500;
}

.strategy-summary .item .value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    max-width: 60%;
}

.prompt-box {
    background: var(--navy-1);
    border: 1px solid var(--navy-line);
    border-radius: var(--radius);
    padding: 18px 20px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 380px;
    overflow-y: auto;
    text-align: left;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.prompt-box::-webkit-scrollbar {
    width: 4px;
}

.prompt-box::-webkit-scrollbar-track {
    background: transparent;
}

.prompt-box::-webkit-scrollbar-thumb {
    background: var(--navy-line);
    border-radius: 4px;
}

.copy-feedback {
    font-size: 14px;
    color: var(--success);
    margin-top: 4px;
    display: none;
}

.copy-feedback.show {
    display: block;
}

/* ========== STATUS / MESSAGE ========== */
.status {
    margin-top: 16px;
    font-size: 14px;
    min-height: 20px;
    color: var(--text-secondary);
    text-align: center;
}

.status.success {
    color: var(--gold-2);
}

.status.error {
    color: var(--danger);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
    body {
        padding: 12px;
    }

    .stage {
        max-width: 100%;
    }

    .brand {
        margin-bottom: 12px;
    }

    .brand-text {
        font-size: 18px;
    }

    .brand svg {
        width: 26px;
        height: 26px;
    }

    .page-title {
        font-size: clamp(30px, 7vw, 40px);
    }

    .page-tagline {
        font-size: clamp(16px, 3vw, 20px);
    }

    .page-description {
        font-size: 15px;
        margin-bottom: 20px;
    }

    .input-group input,
    .input-group textarea {
        font-size: 16px;
        padding: 15px 18px;
    }

    .btn {
        font-size: 15px;
        padding: 14px 20px;
        min-height: 50px;
        width: 100%;
    }

    .actions {
        flex-direction: column;
        gap: 10px;
    }

    .direction-card {
        padding: 14px 16px 12px;
    }

    .direction-card .card-title {
        font-size: 15px;
    }

    .direction-card .card-desc {
        font-size: 12.5px;
    }

    .option-pill {
        padding: 8px 16px;
        font-size: 13px;
    }

    .channel-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .channel-tile {
        padding: 10px 6px;
        font-size: 12px;
    }

    .prompt-box {
        font-size: 12px;
        padding: 14px 16px;
        max-height: 260px;
    }

    .strategy-summary .item {
        font-size: 13px;
        flex-wrap: wrap;
    }

    .strategy-summary .item .value {
        max-width: 100%;
        text-align: left;
        margin-top: 2px;
    }

    .direction-confirm {
        font-size: 14px;
        padding: 12px 16px;
    }

    .suggestion-banner {
        padding: 14px 16px;
    }

    .suggestion-banner .suggestion-actions {
        flex-direction: column;
    }

    .suggestion-banner .suggestion-actions .btn {
        width: 100%;
    }

    .progress-dot {
        width: 6px;
        height: 6px;
    }
}

@media (max-width: 380px) {
    body {
        padding: 8px;
    }

    .channel-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .option-group {
        gap: 6px;
    }

    .option-pill {
        font-size: 12px;
        padding: 6px 14px;
    }

    .page-title {
        font-size: clamp(26px, 6vw, 32px);
    }
}

/* ========== SCREEN TRANSITIONS ========== */
.screen {
    display: none;
    animation: fadeUp 0.3s ease forwards;
}

.screen.active {
    display: block;
}

@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== UTILITY ========== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.mt-8 {
    margin-top: 8px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}