/* CoolPath Discovery — app shell + components
   Brand: navy #0A2E45 (bg), card #123B57, orange accent #F2A541, text #FFFFFF / muted rgba(255,255,255,.68)
*/

:root {
    --cp-navy: #0A2E45;
    --cp-navy-deep: #071F30;
    --cp-card: #123B57;
    --cp-card-hi: #16456A;
    --cp-orange: #F2A541;
    --cp-orange-hi: #FFB55C;
    --cp-text: #FFFFFF;
    --cp-text-muted: rgba(255, 255, 255, 0.68);
    --cp-border: rgba(255, 255, 255, 0.12);
    --cp-success: #4CAF7D;
    --cp-danger: #E4634C;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    background: var(--cp-navy);
}

body {
    margin: 0;
    font-family: 'DM Sans', Arial, sans-serif;
    color: var(--cp-text);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.app-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--cp-navy);
    position: relative;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    padding-top: max(14px, env(safe-area-inset-top));
    position: sticky;
    top: 0;
    background: var(--cp-navy);
    z-index: 20;
    border-bottom: 1px solid var(--cp-border);
}

.app-topbar-title {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--cp-text-muted);
    flex: 1;
    text-align: center;
}

.app-back, .app-back-spacer {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.app-back {
    color: var(--cp-text);
    background: rgba(255, 255, 255, 0.06);
}

.app-content {
    flex: 1;
    padding: 20px 20px 32px;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
}

/* ---- Typography ---- */
h1.cp-h1 { font-size: 26px; font-weight: 800; line-height: 1.25; margin: 0 0 8px; }
h2.cp-h2 { font-size: 20px; font-weight: 700; line-height: 1.3; margin: 0 0 6px; }
p.cp-muted { color: var(--cp-text-muted); font-size: 14.5px; line-height: 1.55; margin: 0 0 16px; }
.cp-eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cp-orange);
    margin-bottom: 6px;
    display: block;
}

/* ---- Buttons ---- */
.cp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 15px 20px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: transform .08s ease, opacity .15s ease;
}
.cp-btn:active { transform: scale(0.98); }
.cp-btn-primary { background: var(--cp-orange); color: var(--cp-navy-deep); }
.cp-btn-primary:hover { background: var(--cp-orange-hi); color: var(--cp-navy-deep); }
.cp-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.cp-btn-ghost { background: rgba(255,255,255,0.08); color: var(--cp-text); }
.cp-btn-ghost:hover { background: rgba(255,255,255,0.14); color: var(--cp-text); }

.cp-btn-fixed {
    position: sticky;
    bottom: 0;
    padding-top: 14px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent, var(--cp-navy) 30%);
    margin-top: auto;
}

/* ---- Cards ---- */
.cp-card {
    background: var(--cp-card);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 14px;
    border: 1px solid var(--cp-border);
}

.cp-module-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
}

.cp-module-card.is-locked { opacity: 0.5; }

.cp-module-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 12px;
    background: rgba(242, 165, 65, 0.15);
    color: var(--cp-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
}

.cp-module-body { flex: 1; min-width: 0; }
.cp-module-title { font-weight: 700; font-size: 15.5px; margin-bottom: 2px; }
.cp-module-meta { font-size: 13px; color: var(--cp-text-muted); }

.cp-progress-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.12);
    overflow: hidden;
    margin-top: 8px;
}
.cp-progress-fill {
    height: 100%;
    background: var(--cp-orange);
    border-radius: 3px;
    transition: width .3s ease;
}

/* ---- Unit list rows ---- */
.cp-unit-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--cp-border);
}
.cp-unit-row:last-child { border-bottom: none; }

.cp-unit-num {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--cp-text-muted);
}
.cp-unit-row.is-complete .cp-unit-num { background: var(--cp-success); color: #fff; }
.cp-unit-row.is-in_progress .cp-unit-num { background: var(--cp-orange); color: var(--cp-navy-deep); }
.cp-unit-row.is-locked { opacity: 0.45; }

.cp-unit-title { font-weight: 600; font-size: 14.5px; }
.cp-unit-sub { font-size: 12.5px; color: var(--cp-text-muted); }

/* ---- Quick check-in ---- */
.cp-checkin {
    background: rgba(242, 165, 65, 0.08);
    border: 1px solid rgba(242, 165, 65, 0.3);
    border-radius: 14px;
    padding: 16px;
    margin-top: 4px;
}
.cp-checkin label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--cp-orange);
    display: block;
    margin-bottom: 8px;
}
.cp-checkin textarea {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--cp-border);
    border-radius: 10px;
    color: var(--cp-text);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14.5px;
    resize: vertical;
}
.cp-checkin textarea:focus { outline: none; border-color: var(--cp-orange); }

/* ---- Quiz ---- */
.cp-quiz-option {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--cp-card);
    border: 1px solid var(--cp-border);
    border-radius: 12px;
    padding: 13px 16px;
    margin-bottom: 10px;
    color: var(--cp-text);
    font-size: 14.5px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.cp-quiz-option:hover { border-color: rgba(242,165,65,0.5); }
.cp-quiz-option.selected { border-color: var(--cp-orange); background: rgba(242,165,65,0.1); }
.cp-quiz-option.correct { border-color: var(--cp-success); background: rgba(76,175,125,0.15); }
.cp-quiz-option.incorrect { border-color: var(--cp-danger); background: rgba(228,99,76,0.15); }
.cp-quiz-option-letter {
    display: inline-flex;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    margin-right: 10px;
}

.cp-feedback { font-size: 14px; margin-top: 10px; padding: 12px 14px; border-radius: 10px; }
.cp-feedback.correct { background: rgba(76,175,125,0.15); color: #A8E6C4; }
.cp-feedback.incorrect { background: rgba(228,99,76,0.15); color: #F7C2B8; }

/* ---- Unit screen steps ---- */
.cp-step { display: none; }
.cp-step.active { display: flex; flex-direction: column; min-height: calc(100vh - 130px); }

/* ---- Auth ---- */
.cp-auth-wrap { padding-top: 40px; }
.cp-logo { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.cp-logo span { color: var(--cp-orange); }
.cp-form-group { margin-bottom: 14px; }
.cp-form-group label { font-size: 13px; font-weight: 600; color: var(--cp-text-muted); display: block; margin-bottom: 6px; }
.cp-form-group input {
    width: 100%;
    background: var(--cp-card);
    border: 1px solid var(--cp-border);
    border-radius: 12px;
    color: var(--cp-text);
    padding: 12px 14px;
    font-size: 15px;
}
.cp-form-group input:focus { outline: none; border-color: var(--cp-orange); }
.cp-alert {
    background: rgba(228,99,76,0.15);
    border: 1px solid rgba(228,99,76,0.4);
    color: #F7C2B8;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 16px;
}
.cp-switch-link { text-align: center; margin-top: 18px; font-size: 14px; color: var(--cp-text-muted); }
.cp-switch-link a { color: var(--cp-orange); font-weight: 700; }

/* ---- Completion / certificate ---- */
.cp-complete-badge {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: rgba(76,175,125,0.15);
    color: var(--cp-success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 8px auto 20px;
    font-size: 40px;
}
.cp-center { text-align: center; }

.cp-cert {
    border: 2px solid var(--cp-orange);
    border-radius: 18px;
    padding: 28px 20px;
    text-align: center;
    background: linear-gradient(160deg, var(--cp-card), var(--cp-navy-deep));
}
.cp-cert-kicker { color: var(--cp-orange); font-weight: 700; letter-spacing: 0.08em; font-size: 12px; text-transform: uppercase; }
.cp-cert-name { font-size: 24px; font-weight: 800; margin: 10px 0 4px; }
.cp-cert-module { font-size: 15px; color: var(--cp-text-muted); margin-bottom: 18px; }
.cp-cert-code { font-family: monospace; font-size: 13px; color: var(--cp-text-muted); letter-spacing: 0.1em; }

@media print {
    .app-topbar, .cp-no-print { display: none !important; }
    body, .app-shell { background: #fff !important; }
}
