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

:root {
    --mud: #3D2B1F;
    --mud-light: #5C4033;
    --earth: #8B6914;
    --water: #1B4332;
    --water-light: #2D6A4F;
    --cream: #F5F0E8;
    --sand: #E8DCC8;
    --gold: #D4A843;
    --warm-white: #FEFCF7;
    --success: #2D6A4F;
    --danger: #9B2C2C;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--warm-white);
    color: var(--mud);
    overflow-x: hidden;
    min-height: 100vh;
}

.screen { min-height: 100vh; }

/* ==================== AUTH SCREEN ==================== */
.auth-container {
    max-width: 440px;
    margin: 0 auto;
    padding: 60px 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.back-link {
    position: absolute;
    top: 24px;
    left: 24px;
    color: var(--mud-light);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.back-link:hover { color: var(--mud); }

.auth-header {
    text-align: center;
    margin-bottom: 48px;
}

.auth-logo {
    font-family: 'Syne', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--mud);
    margin-bottom: 8px;
}

.auth-tagline {
    font-size: 1rem;
    color: var(--mud-light);
    font-style: italic;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 32px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--sand);
}

.auth-tab {
    flex: 1;
    padding: 14px 16px;
    border: none;
    background: var(--warm-white);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mud-light);
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--mud);
    color: var(--cream);
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--mud);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--sand);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    color: var(--mud);
    background: var(--warm-white);
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--gold);
}

.form-group input::placeholder {
    color: #B8A990;
}

.btn-primary {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--mud) 0%, var(--mud-light) 100%);
    color: var(--cream);
    border: none;
    border-radius: 12px;
    font-family: 'Syne', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(61, 43, 31, 0.2);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--sand);
    color: var(--mud);
    border: none;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--cream);
}

.form-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 12px;
    min-height: 20px;
}

/* ==================== APP NAV ==================== */
.app-nav {
    background: var(--mud);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.nav-brand {
    font-family: 'Syne', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--cream);
    text-decoration: none;
}

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

.nav-user {
    font-size: 0.85rem;
    color: rgba(245, 240, 232, 0.6);
}

.nav-logout {
    background: none;
    border: 1px solid rgba(245, 240, 232, 0.2);
    color: rgba(245, 240, 232, 0.6);
    padding: 6px 14px;
    border-radius: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-logout:hover {
    border-color: rgba(245, 240, 232, 0.5);
    color: var(--cream);
}

/* ==================== PHASE HERO ==================== */
.phase-hero {
    padding: 48px 24px 40px;
    background: linear-gradient(175deg, var(--mud) 0%, var(--mud-light) 40%, var(--water) 100%);
    position: relative;
}

.phase-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, var(--warm-white), transparent);
    pointer-events: none;
}

.phase-hero-inner {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.phase-badge {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.phase-hero-emoji {
    font-size: 3.5rem;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.phase-hero-label {
    font-size: 0.75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 500;
    margin-bottom: 4px;
}

.phase-hero-name {
    font-family: 'Syne', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--cream);
}

.phase-hero-mantra {
    font-size: 1.1rem;
    color: rgba(245, 240, 232, 0.6);
    font-style: italic;
    margin-bottom: 32px;
    max-width: 500px;
}

.progress-overview {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.progress-stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-family: 'Syne', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gold);
}

.stat-label {
    font-size: 0.75rem;
    color: rgba(245, 240, 232, 0.45);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 2px;
}

/* ==================== PHASE PROGRESS BAR ==================== */
.phase-progress-section {
    padding: 32px 24px 0;
    background: var(--warm-white);
}

.phase-progress-inner {
    max-width: 800px;
    margin: 0 auto;
}

.phase-progress-bar {
    display: flex;
    gap: 4px;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.phase-segment {
    flex: 1;
    border-radius: 4px;
    transition: opacity 0.3s;
}

.phase-segment.worm { background: var(--earth); }
.phase-segment.pole { background: var(--mud); }
.phase-segment.fish { background: var(--water); }
.phase-segment.inactive { opacity: 0.2; }
.phase-segment.active { opacity: 1; }

.week-dots {
    display: flex;
    gap: 0;
    justify-content: space-between;
    padding: 0 2px;
}

.week-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    position: relative;
}

.week-dot.completed {
    background: var(--success);
    color: white;
}

.week-dot.current {
    background: var(--gold);
    color: var(--mud);
    border-color: var(--mud);
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(212, 168, 67, 0.4);
}

.week-dot.upcoming {
    background: var(--sand);
    color: var(--mud-light);
}

.week-dot:hover {
    transform: scale(1.2);
}

.week-dot.current:hover {
    transform: scale(1.25);
}

/* ==================== WEEK CONTENT ==================== */
.week-content-section {
    padding: 48px 24px;
    background: var(--warm-white);
}

.week-content-inner {
    max-width: 800px;
    margin: 0 auto;
}

.week-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.week-number-badge {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Syne', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--cream);
    flex-shrink: 0;
}

.week-number-badge.worm { background: var(--earth); }
.week-number-badge.pole { background: var(--mud); }
.week-number-badge.fish { background: var(--water); }

.week-title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    color: var(--mud);
}

.week-subtitle {
    font-size: 0.95rem;
    color: var(--mud-light);
    margin-top: 4px;
}

.week-description {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--mud-light);
    margin-bottom: 24px;
    max-width: 640px;
}

.week-quote {
    font-family: 'Syne', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--mud);
    padding: 20px 24px;
    border-left: 4px solid var(--gold);
    background: rgba(232, 220, 200, 0.3);
    border-radius: 0 10px 10px 0;
    margin-bottom: 48px;
    font-style: italic;
}

/* ==================== EXERCISES ==================== */
.exercises-section {
    margin-bottom: 48px;
}

.exercises-header {
    font-family: 'Syne', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--mud);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--sand);
}

.exercises-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.exercise-card {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--warm-white);
    border: 2px solid var(--sand);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    align-items: flex-start;
}

.exercise-card:hover {
    border-color: var(--gold);
    transform: translateX(4px);
}

.exercise-card.completed {
    background: rgba(45, 106, 79, 0.04);
    border-color: var(--success);
}

.exercise-checkbox {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 2px solid var(--sand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.exercise-card.completed .exercise-checkbox {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.exercise-card:not(.completed) .exercise-checkbox::after {
    content: '';
}

.exercise-card.completed .exercise-checkbox::after {
    content: '\2713';
}

.exercise-info {
    flex: 1;
}

.exercise-title {
    font-family: 'Syne', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--mud);
    margin-bottom: 4px;
}

.exercise-card.completed .exercise-title {
    color: var(--success);
}

.exercise-desc {
    font-size: 0.9rem;
    color: var(--mud-light);
    line-height: 1.6;
}

/* ==================== REFLECTION ==================== */
.reflection-section {
    margin-bottom: 48px;
}

.reflection-header {
    font-family: 'Syne', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--mud);
    margin-bottom: 16px;
}

.reflection-input {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 2px solid var(--sand);
    border-radius: 12px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: var(--mud);
    background: var(--warm-white);
    resize: vertical;
    margin-bottom: 12px;
    line-height: 1.6;
}

.reflection-input:focus {
    outline: none;
    border-color: var(--gold);
}

.reflection-input::placeholder {
    color: #B8A990;
}

/* ==================== ADVANCE SECTION ==================== */
.advance-section {
    margin-bottom: 48px;
}

.advance-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 32px;
    background: linear-gradient(135deg, var(--water) 0%, var(--water-light) 100%);
    border-radius: 16px;
    gap: 24px;
}

.advance-content h3 {
    font-family: 'Syne', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--cream);
    margin-bottom: 4px;
}

.advance-content p {
    font-size: 0.95rem;
    color: rgba(245, 240, 232, 0.7);
}

.btn-advance {
    padding: 14px 28px;
    background: var(--gold);
    color: var(--mud);
    border: none;
    border-radius: 10px;
    font-family: 'Syne', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-advance:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* ==================== COMPLETION ==================== */
.completion-section {
    padding: 48px 0;
}

.completion-card {
    text-align: center;
    padding: 64px 32px;
    background: linear-gradient(175deg, var(--mud) 0%, var(--water) 100%);
    border-radius: 24px;
}

.completion-emoji {
    font-size: 4rem;
    display: block;
    margin-bottom: 24px;
}

.completion-card h2 {
    font-family: 'Syne', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--cream);
    margin-bottom: 16px;
}

.completion-card p {
    font-size: 1.1rem;
    color: rgba(245, 240, 232, 0.7);
    margin-bottom: 8px;
}

.completion-quote {
    font-family: 'Syne', sans-serif;
    font-style: italic;
    color: var(--gold) !important;
    font-size: 1.2rem !important;
    margin-top: 24px !important;
    font-weight: 600;
}

.completion-sub {
    margin-top: 8px;
}

/* ==================== WEEK BROWSER ==================== */
.week-browser-section {
    padding: 48px 24px 80px;
    background: var(--sand);
}

.week-browser-inner {
    max-width: 800px;
    margin: 0 auto;
}

.week-browser-header {
    font-family: 'Syne', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--mud);
    margin-bottom: 24px;
}

.week-browser {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.week-browser-card {
    padding: 16px;
    background: var(--warm-white);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.week-browser-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.week-browser-card.current {
    border-color: var(--gold);
    box-shadow: 0 4px 16px rgba(212, 168, 67, 0.15);
}

.week-browser-card.completed {
    border-color: var(--success);
}

.week-browser-card.locked {
    opacity: 0.5;
    cursor: default;
}

.week-browser-card.locked:hover {
    transform: none;
    box-shadow: none;
}

.week-browser-number {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    margin-bottom: 6px;
}

.week-browser-number.worm { color: var(--earth); }
.week-browser-number.pole { color: var(--mud-light); }
.week-browser-number.fish { color: var(--water); }

.week-browser-title {
    font-family: 'Syne', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--mud);
}

.week-browser-status {
    font-size: 0.75rem;
    margin-top: 6px;
    color: var(--mud-light);
}

.week-browser-card.completed .week-browser-status {
    color: var(--success);
}

/* ==================== APP FOOTER ==================== */
.app-footer {
    padding: 40px 24px;
    background: var(--mud);
    text-align: center;
}

.app-footer-brand {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    color: rgba(245, 240, 232, 0.5);
    margin-bottom: 8px;
    font-size: 1rem;
}

.app-footer p {
    font-size: 0.85rem;
    color: rgba(245, 240, 232, 0.35);
}

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--warm-white);
    border-radius: 24px;
    padding: 48px 40px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-emoji {
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
}

.phase-transition-modal h2 {
    font-family: 'Syne', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--mud);
    margin-bottom: 12px;
}

.modal-mantra {
    font-style: italic;
    color: var(--gold);
    font-size: 1.05rem;
    margin-bottom: 16px;
    font-weight: 500;
}

.modal-desc {
    font-size: 0.95rem;
    color: var(--mud-light);
    line-height: 1.7;
    margin-bottom: 32px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
    .phase-badge {
        gap: 14px;
    }

    .phase-hero-emoji {
        font-size: 2.5rem;
    }

    .progress-overview {
        gap: 24px;
    }

    .week-dots {
        display: none;
    }

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

    .advance-card {
        flex-direction: column;
        text-align: center;
    }

    .exercise-card {
        padding: 16px;
    }

    .auth-container {
        padding: 40px 20px;
    }

    .week-browser {
        grid-template-columns: 1fr;
    }
}

/* ==================== LOADING ==================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    font-size: 1.1rem;
    color: var(--mud-light);
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 3px solid var(--sand);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 12px;
}

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

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 24px;
    background: var(--mud);
    color: var(--cream);
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 2000;
    transition: transform 0.3s ease;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}
