/* PhishTested App Styles - Matches landing page design language */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --ink: #0a0f1a;
    --slate: #2d3548;
    --muted: #6b7394;
    --light: #b0b8d1;
    --surface: #f4f5fa;
    --white: #ffffff;
    --red: #e53e3e;
    --red-soft: #fed7d7;
    --green: #1db954;
    --green-soft: #c6f6d5;
    --amber: #f6ad55;
    --amber-soft: #fefcbf;
    --blue: #3b82f6;
    --purple: #8b5cf6;
    --pink: #ec4899;
    --indigo: #6366f1;
}

body {
    font-family: 'DM Sans', sans-serif;
    color: var(--ink);
    background: var(--surface);
    min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; }

/* App Nav */
.app-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.app-nav .logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--ink);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.app-nav .logo-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
}
.app-nav .logo-icon svg {
    width: 100%;
    height: 100%;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-link {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: all 0.2s;
}
.nav-link:hover { color: var(--ink); background: var(--surface); }
.nav-link.active { color: var(--ink); background: var(--surface); }
.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-user-name {
    font-size: 14px;
    color: var(--slate);
    font-weight: 500;
}
.btn-logout {
    padding: 6px 14px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 6px;
    background: none;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* Main container */
.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 100px 24px 60px;
}

/* Page header */
.page-header {
    margin-bottom: 40px;
}
.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 8px;
}
.page-header p {
    font-size: 16px;
    color: var(--muted);
    line-height: 1.6;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 32px;
    transition: all 0.2s;
}
.card:hover {
    border-color: rgba(0,0,0,0.1);
    box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-primary {
    background: var(--ink);
    color: var(--white);
}
.btn-primary:hover { background: var(--slate); transform: translateY(-1px); }
.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid rgba(0,0,0,0.08);
}
.btn-secondary:hover { background: #ecedf2; }
.btn-danger {
    background: var(--red);
    color: var(--white);
}
.btn-danger:hover { background: #c53030; }
.btn-success {
    background: var(--green);
    color: var(--white);
}
.btn-success:hover { background: #18a34a; }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--slate);
    margin-bottom: 6px;
}
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--white);
    transition: border-color 0.2s;
    outline: none;
}
.form-input:focus { border-color: var(--ink); }
.form-input::placeholder { color: var(--light); }
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--white);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7394' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}
.form-select:focus { border-color: var(--ink); }
.form-hint {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

/* Alert/Error */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 20px;
    display: none;
}
.alert.show { display: block; }
.alert-error {
    background: var(--red-soft);
    color: var(--red);
    border: 1px solid rgba(229,62,62,0.2);
}
.alert-success {
    background: var(--green-soft);
    color: #166534;
    border: 1px solid rgba(29,185,84,0.2);
}
.alert-warning {
    background: var(--amber-soft);
    color: #92400e;
    border: 1px solid rgba(246,173,85,0.2);
}

/* Auth layout */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--surface);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border-radius: 20px;
    padding: 48px 40px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 4px 40px rgba(0,0,0,0.04);
}
.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
    text-decoration: none;
}
.auth-logo .logo-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
}
.auth-logo .logo-icon svg {
    width: 100%;
    height: 100%;
}
.auth-logo span {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
}
.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}
.auth-subtitle {
    font-size: 15px;
    color: var(--muted);
    margin-bottom: 32px;
    line-height: 1.5;
}
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--muted);
}
.auth-footer a {
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }

/* Category cards */
.category-card {
    background: var(--white);
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 28px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-color, var(--ink));
}
.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    border-color: rgba(0,0,0,0.12);
}
.category-icon {
    font-size: 28px;
    margin-bottom: 12px;
}
.category-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}
.category-meta {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 16px;
}
.progress-bar {
    height: 6px;
    background: var(--surface);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--green);
    transition: width 0.5s ease;
}
.progress-text {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}

/* Quiz UI */
.quiz-container {
    max-width: 700px;
    margin: 0 auto;
}
.quiz-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}
.quiz-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(0,0,0,0.06);
    border-radius: 2px;
}
.quiz-progress-fill {
    height: 100%;
    background: var(--ink);
    border-radius: 2px;
    transition: width 0.3s ease;
}
.quiz-progress-text {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
}
.quiz-scenario {
    background: var(--white);
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 32px;
    margin-bottom: 24px;
}
.quiz-scenario-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--red);
    margin-bottom: 16px;
}
.quiz-scenario-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--slate);
    white-space: pre-line;
}
.quiz-question {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
    line-height: 1.3;
}
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}
.quiz-option {
    padding: 16px 20px;
    border: 2px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--white);
}
.quiz-option:hover { border-color: var(--ink); }
.quiz-option.selected { border-color: var(--ink); background: rgba(10,15,26,0.03); }
.quiz-option.correct { border-color: var(--green); background: var(--green-soft); }
.quiz-option.incorrect { border-color: var(--red); background: var(--red-soft); }
.quiz-option-label {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
}
.quiz-option.selected .quiz-option-label { background: var(--ink); color: var(--white); }
.quiz-option.correct .quiz-option-label { background: var(--green); color: var(--white); }
.quiz-option.incorrect .quiz-option-label { background: var(--red); color: var(--white); }
.quiz-option-text {
    font-size: 15px;
    color: var(--slate);
    line-height: 1.5;
    padding-top: 3px;
}
.quiz-explanation {
    background: rgba(59,130,246,0.06);
    border: 1px solid rgba(59,130,246,0.15);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    display: none;
}
.quiz-explanation.show { display: block; }
.quiz-explanation-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--blue);
    margin-bottom: 8px;
}
.quiz-explanation-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--slate);
}

/* Results */
.results-card {
    background: var(--white);
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 48px;
    text-align: center;
}
.results-score {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 72px;
    font-weight: 700;
    letter-spacing: -3px;
    margin-bottom: 8px;
}
.results-score.high { color: var(--green); }
.results-score.medium { color: var(--amber); }
.results-score.low { color: var(--red); }
.results-label {
    font-size: 16px;
    color: var(--muted);
    margin-bottom: 32px;
}
.results-breakdown {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 32px;
}
.results-stat {
    text-align: center;
}
.results-stat-number {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 28px;
    font-weight: 700;
}
.results-stat-label {
    font-size: 13px;
    color: var(--muted);
}
.results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Stats cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-box {
    background: var(--white);
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 24px;
}
.stat-box-label {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
}
.stat-box-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--ink);
}
.stat-box-value.green { color: var(--green); }
.stat-box-value.red { color: var(--red); }
.stat-box-value.amber { color: var(--amber); }

/* Parent dashboard */
.teen-card {
    background: var(--white);
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 32px;
    margin-bottom: 20px;
}
.teen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.teen-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 700;
}
.teen-score-badge {
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
}
.teen-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.teen-cat {
    padding: 16px;
    background: var(--surface);
    border-radius: 10px;
}
.teen-cat-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--slate);
    margin-bottom: 8px;
}
.teen-cat-score {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 24px;
    font-weight: 700;
}

/* Family code box */
.family-code-box {
    background: linear-gradient(135deg, var(--ink) 0%, var(--slate) 100%);
    border-radius: 16px;
    padding: 28px;
    color: var(--white);
    margin-bottom: 32px;
}
.family-code-label {
    font-size: 13px;
    color: var(--light);
    margin-bottom: 4px;
}
.family-code-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 36px;
    font-weight: 700;
    letter-spacing: 6px;
}
.family-code-hint {
    font-size: 13px;
    color: var(--light);
    margin-top: 8px;
}

/* Subscribe page */
.pricing-card {
    max-width: 480px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 20px;
    border: 2px solid var(--ink);
    padding: 48px;
    text-align: center;
    position: relative;
}
.pricing-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 20px;
    background: var(--ink);
    color: var(--white);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.pricing-amount {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 56px;
    font-weight: 700;
    letter-spacing: -2px;
    margin: 24px 0 4px;
}
.pricing-period {
    font-size: 15px;
    color: var(--muted);
    margin-bottom: 32px;
}
.pricing-features {
    list-style: none;
    text-align: left;
    margin-bottom: 36px;
}
.pricing-features li {
    padding: 10px 0;
    border-top: 1px solid rgba(0,0,0,0.05);
    font-size: 15px;
    color: var(--slate);
    display: flex;
    align-items: center;
    gap: 10px;
}
.pricing-features li::before {
    content: '✓';
    font-weight: 700;
    color: var(--green);
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--surface);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}
.empty-text {
    font-size: 16px;
    color: var(--muted);
    margin-bottom: 24px;
}

/* Role selector */
.role-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.role-option {
    padding: 16px 12px;
    border: 2px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.role-option:hover { border-color: rgba(0,0,0,0.2); }
.role-option.selected { border-color: var(--ink); background: rgba(10,15,26,0.03); }
.role-option-icon { font-size: 24px; margin-bottom: 6px; }
.role-option-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--slate);
}

/* Mobile bottom navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0,0,0,0.08);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    min-width: 70px;
    min-height: 56px;
    text-decoration: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: 12px;
    gap: 4px;
}

.mobile-nav-item:hover {
    background: var(--surface);
    color: var(--ink);
}

.mobile-nav-item.active {
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
}

.mobile-nav-icon {
    font-size: 20px;
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .app-nav { padding: 12px 16px; }
    .app-container {
        padding: 80px 16px 40px;
    }
    .auth-card { padding: 32px 24px; }
    .card-grid { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .results-breakdown { gap: 20px; }
    .results-actions { flex-direction: column; }
    .role-options { grid-template-columns: 1fr; }
    .quiz-scenario { padding: 20px; }
    .quiz-question { font-size: 18px; }
    .nav-links { display: none; }
    .pricing-card { padding: 32px 24px; }
    .teen-categories { grid-template-columns: 1fr 1fr; }
    .family-code-value { font-size: 28px; letter-spacing: 4px; }

    /* Show mobile bottom nav */
    .mobile-nav { display: block; }

    /* Add bottom padding to container when mobile nav is shown */
    body:not(.no-mobile-nav) .app-container {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    /* Touch-friendly buttons */
    .btn {
        min-height: 44px;
        padding: 14px 24px;
    }
    .btn-sm {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 14px;
    }

    /* Mobile nav user */
    .nav-user-name { display: none; }
    .btn-logout { min-height: 44px; padding: 10px 16px; }

    /* Category cards - bigger tap targets */
    .category-card {
        padding: 24px;
        min-height: 120px;
    }

    /* Quiz options - touch-friendly */
    .quiz-option {
        padding: 18px 20px;
        min-height: 60px;
    }

    /* Results actions - full width buttons */
    .results-actions .btn {
        width: 100%;
    }
}

/* Responsive - Phone */
@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr; }
    .teen-categories { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 28px; }
    .page-header p { font-size: 15px; }

    /* Prevent iOS zoom on inputs - CRITICAL */
    .form-input, .form-select {
        font-size: 16px !important;
    }

    /* Card padding */
    .card { padding: 24px; }
    .card-grid { gap: 12px; }

    /* Quiz UI */
    .quiz-container { padding: 0; }
    .quiz-scenario {
        padding: 20px;
        margin-bottom: 20px;
    }
    .quiz-scenario-text { font-size: 14px; }
    .quiz-question {
        font-size: 20px;
        margin-bottom: 20px;
    }
    .quiz-option {
        padding: 16px;
    }
    .quiz-option-text { font-size: 14px; }

    /* Results */
    .results-card { padding: 32px 24px; }
    .results-score { font-size: 56px; }
    .results-breakdown {
        gap: 16px;
        flex-wrap: wrap;
    }
    .results-stat { min-width: 80px; }

    /* Auth layout */
    .auth-card {
        padding: 28px 20px;
        border-radius: 16px;
    }

    /* Teen dashboard */
    .teen-card { padding: 24px; }
    .teen-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* Responsive - Small Phone */
@media (max-width: 375px) {
    .app-nav { padding: 10px 12px; }
    .app-nav .logo { font-size: 18px; }
    .app-nav .logo-icon { width: 26px; height: 26px; }
    .app-container { padding: 70px 12px 32px; }

    .page-header h1 { font-size: 24px; }
    .page-header { margin-bottom: 24px; }

    .card { padding: 20px; }
    .category-card { padding: 20px; }

    .quiz-scenario { padding: 16px; }
    .quiz-question { font-size: 18px; }
    .quiz-option { padding: 14px; }

    .results-card { padding: 24px 16px; }
    .results-score { font-size: 48px; letter-spacing: -2px; }

    .family-code-value { font-size: 24px; letter-spacing: 3px; }
}
