/* ===== NAFAS APP STYLES ===== */
/* Matches landing page design tokens */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Noto+Kufi+Arabic:wght@400;500;600;700&display=swap');

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

:root {
    --emerald: #0D6B58;
    --emerald-deep: #064E3B;
    --emerald-light: #10B981;
    --gold: #D4A853;
    --gold-soft: #F5E6C8;
    --cream: #FEFCF6;
    --charcoal: #1A1A2E;
    --slate: #4A5568;
    --mist: #E8F0EC;
    --red: #DC2626;
    --red-soft: #FEE2E2;
}

body {
    font-family: 'Noto Kufi Arabic', 'Plus Jakarta Sans', sans-serif;
    background: var(--cream);
    color: var(--charcoal);
    direction: rtl;
    min-height: 100vh;
}

/* ===== LAYOUT ===== */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(13,107,88,0.1);
    margin-bottom: 1.5rem;
}

.app-logo {
    font-family: 'Noto Kufi Arabic', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--emerald-deep);
    text-decoration: none;
}

.app-logo span {
    color: var(--gold);
    font-size: 0.7rem;
    font-weight: 500;
    display: block;
    letter-spacing: 0.1em;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-reset {
    background: none;
    border: 1px solid var(--red);
    color: var(--red);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-reset:hover {
    background: var(--red-soft);
}

/* ===== VIEWS (shown/hidden) ===== */
.view { display: none; flex: 1; }
.view.active { display: flex; flex-direction: column; }

/* ===== ONBOARDING ===== */
.onboarding-header {
    text-align: center;
    padding: 2rem 0;
}

.onboarding-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.onboarding-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--emerald-deep);
    margin-bottom: 0.5rem;
}

.onboarding-subtitle {
    font-size: 0.95rem;
    color: var(--slate);
    line-height: 1.6;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 0.5rem;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid var(--mist);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
    color: var(--charcoal);
    direction: rtl;
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--emerald);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-input::placeholder, .form-textarea::placeholder {
    color: #B0B8C4;
}

/* ===== BUTTONS ===== */
.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--emerald-deep), var(--emerald));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6,78,59,0.3);
}

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

.btn-secondary {
    width: 100%;
    padding: 0.85rem;
    background: white;
    color: var(--emerald-deep);
    border: 2px solid var(--emerald);
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-gold {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--gold), #C4943A);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-gold:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212,168,83,0.4);
}

/* ===== DASHBOARD ===== */
.dashboard-greeting {
    text-align: center;
    padding: 1.5rem 0;
}

.greeting-emoji {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.greeting-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--emerald-deep);
    margin-bottom: 0.25rem;
}

.greeting-sub {
    font-size: 0.9rem;
    color: var(--slate);
}

/* Progress Bar */
.progress-section {
    background: white;
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(13,107,88,0.08);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--charcoal);
}

.progress-count {
    font-size: 0.8rem;
    color: var(--emerald);
    font-weight: 600;
}

.progress-bar {
    height: 10px;
    background: var(--mist);
    border-radius: 10px;
    overflow: hidden;
    direction: ltr;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--emerald-deep), var(--emerald-light));
    border-radius: 10px;
    transition: width 0.5s ease;
}

/* Day Cards */
.days-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.day-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: 14px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.day-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.day-card.current {
    border-color: var(--emerald);
    background: linear-gradient(135deg, rgba(13,107,88,0.04), rgba(16,185,129,0.04));
}

.day-card.completed {
    border-color: var(--emerald-light);
    background: rgba(16,185,129,0.06);
}

.day-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.day-number {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.day-card.current .day-number {
    background: var(--emerald);
    color: white;
}

.day-card.completed .day-number {
    background: var(--emerald-light);
    color: white;
}

.day-card.locked .day-number {
    background: var(--mist);
    color: var(--slate);
}

.day-info {
    flex: 1;
}

.day-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--charcoal);
    margin-bottom: 0.2rem;
}

.day-status {
    font-size: 0.8rem;
    color: var(--slate);
}

.day-card.current .day-status {
    color: var(--emerald);
    font-weight: 600;
}

.day-card.completed .day-status {
    color: var(--emerald-light);
}

.day-arrow {
    font-size: 1.2rem;
    color: var(--slate);
}

.day-card.current .day-arrow {
    color: var(--emerald);
}

.day-card.completed .day-arrow {
    color: var(--emerald-light);
}

/* Motivation card */
.motivation-card {
    background: linear-gradient(135deg, var(--emerald-deep), var(--emerald));
    border-radius: 16px;
    padding: 1.5rem;
    color: white;
    text-align: center;
    margin-bottom: 1.5rem;
}

.motivation-label {
    font-size: 0.75rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.motivation-text {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.6;
}

/* ===== DAY VIEW ===== */
.day-view-header {
    background: linear-gradient(135deg, var(--emerald-deep), var(--emerald));
    margin: -1rem -1rem 0;
    padding: 2rem 1.5rem;
    color: white;
    border-radius: 0 0 24px 24px;
    text-align: center;
    position: relative;
}

.back-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(255,255,255,0.25);
}

.day-view-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.day-view-subtitle {
    font-size: 0.8rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.25rem;
}

.day-view-title {
    font-size: 1.4rem;
    font-weight: 700;
}

.day-content {
    padding: 1.5rem 0;
    flex: 1;
}

.day-intro {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--slate);
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    border-right: 4px solid var(--gold);
}

/* Lesson sections */
.lesson-section {
    background: white;
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(13,107,88,0.06);
}

.lesson-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--emerald-deep);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lesson-content {
    font-size: 0.92rem;
    line-height: 1.9;
    color: var(--charcoal);
}

.lesson-content strong {
    color: var(--emerald-deep);
}

.lesson-content em {
    color: var(--emerald);
    font-style: normal;
    font-weight: 600;
}

/* Tip card */
.tip-section {
    background: var(--gold-soft);
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(212,168,83,0.2);
}

.tip-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--charcoal);
    margin-bottom: 0.5rem;
}

.tip-content {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--slate);
}

/* Exercise section */
.exercise-section {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border: 2px solid var(--emerald);
}

.exercise-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.exercise-badge {
    background: var(--emerald);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
}

.exercise-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--emerald-deep);
}

.exercise-description {
    font-size: 0.88rem;
    color: var(--slate);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.exercise-group {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--cream);
    border-radius: 12px;
}

.exercise-group-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--emerald-deep);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--mist);
}

.exercise-field {
    margin-bottom: 0.75rem;
}

.exercise-field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 0.3rem;
}

.exercise-input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1.5px solid var(--mist);
    border-radius: 10px;
    font-size: 0.88rem;
    font-family: inherit;
    background: white;
    color: var(--charcoal);
    direction: rtl;
    transition: border-color 0.2s;
}

.exercise-input:focus {
    outline: none;
    border-color: var(--emerald);
}

.exercise-input::placeholder {
    color: #C0C8D0;
    font-size: 0.82rem;
}

/* Reflection */
.reflection-section {
    background: linear-gradient(135deg, rgba(13,107,88,0.06), rgba(16,185,129,0.04));
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border-right: 4px solid var(--emerald);
}

.reflection-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--emerald-deep);
    margin-bottom: 0.5rem;
}

.reflection-content {
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--slate);
}

/* Complete day button area */
.day-actions {
    padding: 1rem 0 2rem;
}

/* ===== COMPLETION VIEW ===== */
.completion-view {
    text-align: center;
    padding: 3rem 1rem;
}

.completion-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.completion-title {
    font-family: 'Noto Kufi Arabic', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--emerald-deep);
    margin-bottom: 0.5rem;
}

.completion-subtitle {
    font-size: 1rem;
    color: var(--slate);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.completion-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.completion-stat {
    background: white;
    border-radius: 14px;
    padding: 1.25rem;
    border: 1px solid rgba(13,107,88,0.08);
}

.completion-stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--emerald);
}

.completion-stat-label {
    font-size: 0.8rem;
    color: var(--slate);
    margin-top: 0.25rem;
}

.completion-quote {
    font-family: 'Noto Kufi Arabic', serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--emerald-deep);
    margin: 2rem 0;
    line-height: 1.6;
}

/* ===== LOADING ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    flex-direction: column;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--mist);
    border-top-color: var(--emerald);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 0.9rem;
    color: var(--slate);
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--charcoal);
    color: white;
    padding: 0.85rem 1.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-family: inherit;
    z-index: 1000;
    transition: transform 0.3s ease;
    max-width: 90%;
    text-align: center;
}

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

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

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

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .app-container {
        padding: 0.75rem;
    }

    .day-view-header {
        margin: -0.75rem -0.75rem 0;
        padding: 1.5rem 1rem;
    }

    .completion-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
}
