/* ============================================================
   مدرسة هندسة النفس - V1
   css/styles.css — Design Tokens & Component Styles
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&display=swap");

/* --- CSS Variables / Design Tokens --- */
:root {
    --bg:            #f7f3ee;
    --ink:           #1a1410;
    --ink-muted:     #5c4d42;
    --ink-faint:     #a09080;
    --accent:        #9b3d12;
    --accent-hover:  #7d3010;
    --accent-light:  #f5e8e0;
    --surface:       #ffffff;
    --border:        #e4dbd2;
    --gold:          #d4a574;
    --gold-hover:    #c49564;
    --life-accent:   #1a5e3c;
    --life-accent-hover: #134a2f;
    --life-accent-light: #e8f4ee;
}

/* --- Reset & Base --- */
* {
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

html, body {
    background: var(--bg);
    overflow-x: hidden;
    max-width: 100vw;
}
#root {
    background: transparent;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

html, body, #root {
    color: var(--ink);
    direction: rtl;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
}

button, input {
    font-family: inherit;
}

/* --- Buttons --- */
.btn-rust {
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    text-align: center;
    border: none;
    border-radius: 8px;
    padding: 12px 28px;
    font-weight: 800;
    font-size: 15px;
    transition: background 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-block;
    box-shadow: 0 4px 12px rgba(155, 61, 18, 0.15);
    position: relative;
    overflow: hidden;
}
.btn-rust::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.btn-rust:hover::before { opacity: 1; }
.btn-rust:hover {
    background: var(--accent-hover);
    box-shadow: 0 8px 28px rgba(155, 61, 18, 0.30);
}
.btn-rust:active {
    transform: translateY(1px) scale(0.98) !important;
    transition-duration: 0.1s !important;
}
.btn-rust:disabled {
    background: var(--border);
    color: var(--ink-faint);
    cursor: not-allowed;
    box-shadow: none;
    transform: none !important;
}

.btn-gold {
    background: var(--gold);
    color: #1a1410;
    cursor: pointer;
    text-align: center;
    border: none;
    border-radius: 8px;
    padding: 14px 32px;
    font-weight: 800;
    font-size: 16px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-block;
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.2);
    position: relative;
    overflow: hidden;
}
.btn-gold::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.btn-gold:hover::before { opacity: 1; }
.btn-gold:hover {
    background: var(--gold-hover);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 28px rgba(212, 165, 116, 0.35);
}

.btn-outline {
    color: var(--ink);
    border: 1px solid var(--border);
    cursor: pointer;
    text-align: center;
    background: transparent;
    border-radius: 8px;
    padding: 12px 28px;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-block;
}
.btn-outline:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    transform: translateY(-2px);
}
.btn-outline:disabled {
    border-color: var(--border);
    color: var(--ink-faint);
    cursor: not-allowed;
    background: transparent;
    transform: none;
}

/* --- Core Animations --- */
@keyframes pulse-glow {
    0%   { box-shadow: 0 0 0 0 rgba(212, 165, 116, 0.5); }
    70%  { box-shadow: 0 0 0 12px rgba(212, 165, 116, 0); }
    100% { box-shadow: 0 0 0 0 rgba(212, 165, 116, 0); }
}
.pulse-btn { animation: pulse-glow 2s infinite; }

@keyframes choice-pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}
.choice-active { animation: choice-pulse 0.25s ease-out; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in-entry {
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --- Cards --- */
.need-card {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}
.need-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(26, 20, 16, 0.1);
}

/* --- Custom Range Slider --- */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    border-radius: 4px;
    outline: none;
    width: 100%;
    height: 8px;
    margin: 15px 0;
    transition: background 0.1s ease;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    border: 4px solid #ffffff;
    cursor: pointer;
    background: var(--ink);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease, background-color 0.15s ease;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.3); }
input[type=range]::-moz-range-thumb {
    border: 4px solid #ffffff;
    cursor: pointer;
    background: var(--ink);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease, background-color 0.15s ease;
}
input[type=range]::-moz-range-thumb:hover { transform: scale(1.2); }

/* --- Scrollbar --- */
::-webkit-scrollbar       { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

/* --- 3D Book Cover --- */
.book-container-3d { perspective: 800px; display: inline-block; }
.book-cover-3d {
    transform: rotateY(-18deg) rotateX(5deg);
    transform-style: preserve-3d;
    box-shadow: -10px 10px 25px rgba(26, 20, 16, 0.25),
                -1px 2px 5px rgba(26, 20, 16, 0.1);
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    border-radius: 4px 8px 8px 4px;
    display: block;
}
.book-container-3d:hover .book-cover-3d {
    transform: rotateY(-5deg) rotateX(2deg) scale(1.02);
    box-shadow: -15px 15px 35px rgba(26, 20, 16, 0.35),
                -2px 3px 8px rgba(26, 20, 16, 0.15);
}

/* ============================================================
   MOTION ENHANCEMENTS — V2
   عصرية حقيقية، لا ديكور
   ============================================================ */

/* ─── Screen Transition ──────────────────────────────────── */
@keyframes screenEnter {
    from {
        opacity: 0;
        transform: translateY(22px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.screen-enter {
    animation: screenEnter 0.50s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ─── Phrase Crossfade ────────────────────────────────────── */
@keyframes phraseFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
        filter: blur(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}
.phrase-enter {
    animation: phraseFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ─── Floating Orbs ──────────────────────────────────────── */
@keyframes floatA {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(22px, -26px) scale(1.07); }
    66%       { transform: translate(-15px, 16px) scale(0.96); }
}
@keyframes floatB {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%       { transform: translate(-24px, 24px) scale(1.06); }
}
@keyframes floatC {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    40%       { transform: translate(14px, -20px) rotate(5deg); }
    80%       { transform: translate(-12px, 12px) rotate(-3deg); }
}
.orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(58px);
    z-index: 0;
}
.orb-1 {
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(155, 61, 18, 0.14) 0%, transparent 70%);
    animation: floatA 11s ease-in-out infinite;
    top: -80px;
    right: -100px;
}
.orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(212, 165, 116, 0.12) 0%, transparent 70%);
    animation: floatB 14s ease-in-out infinite;
    bottom: 0;
    left: -80px;
}
.orb-3 {
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(155, 61, 18, 0.08) 0%, transparent 70%);
    animation: floatC 9s ease-in-out infinite;
    top: 40%;
    left: 6%;
}

/* ─── Modal Spring ────────────────────────────────────────── */
@keyframes modalSpring {
    0%   { opacity: 0; transform: scale(0.86) translateY(16px); }
    55%  { transform: scale(1.03) translateY(-4px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-spring {
    animation: modalSpring 0.48s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes backdropIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.backdrop-in {
    animation: backdropIn 0.3s ease both;
}

/* ─── Score Bars Reveal ───────────────────────────────────── */
.bar-wrap {
    overflow: hidden;
    border-radius: 3px;
}
.bar-inner {
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* ─── Stagger Delays ─────────────────────────────────────── */
.stagger-1 { animation-delay: 0.05s !important; }
.stagger-2 { animation-delay: 0.13s !important; }
.stagger-3 { animation-delay: 0.21s !important; }
.stagger-4 { animation-delay: 0.29s !important; }
.stagger-5 { animation-delay: 0.37s !important; }
.stagger-6 { animation-delay: 0.45s !important; }

/* ─── Result Cards Stagger ───────────────────────────────── */
@keyframes revealUp {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}
.result-card {
    opacity: 0;
    animation: revealUp 0.62s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ─── Book Cards Reveal ──────────────────────────────────── */
@keyframes revealScale {
    from { opacity: 0; transform: scale(0.93) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.book-card-reveal {
    opacity: 0;
    animation: revealScale 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ─── Book Glare Effect ──────────────────────────────────── */
.book-glare-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
}
.book-glare-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        118deg,
        rgba(255, 255, 255, 0)    32%,
        rgba(255, 255, 255, 0.20) 50%,
        rgba(255, 255, 255, 0)    68%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.45s ease;
    border-radius: 6px;
}
.book-glare-wrap:hover .book-glare-overlay {
    opacity: 1;
}

/* ─── Nav Active Indicator ────────────────────────────────── */
.nav-tab-btn {
    position: relative;
}
@keyframes pillGrow {
    from { opacity: 0; transform: scaleX(0.5); }
    to   { opacity: 1; transform: scaleX(1); }
}
.nav-active-dot {
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--gold);
    animation: pillGrow 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ─── Slider Thumb Pulse on Change ──────────────────────────  */
@keyframes thumbPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.4); }
    100% { transform: scale(1.15); }
}
input[type=range]:focus::-webkit-slider-thumb {
    transform: scale(1.2);
    background: var(--accent);
}
input[type=range]:active::-webkit-slider-thumb {
    animation: thumbPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ─── Scroll Reveal ──────────────────────────────────────── */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.reveal.delay-1 { transition-delay: 0.08s; }
.reveal.delay-2 { transition-delay: 0.18s; }
.reveal.delay-3 { transition-delay: 0.28s; }
.reveal.delay-4 { transition-delay: 0.38s; }

/* ─── Quote Section Reveal ───────────────────────────────── */
@keyframes quoteReveal {
    from {
        opacity: 0;
        transform: scale(0.97);
        letter-spacing: 0.05em;
    }
    to {
        opacity: 1;
        transform: scale(1);
        letter-spacing: normal;
    }
}
.quote-reveal.is-visible p {
    animation: quoteReveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.1s;
}

/* ─── Progress Bar Animated Fill ─────────────────────────── */
@keyframes progressExpand {
    from { width: 0 !important; }
}
.progress-animated {
    animation: progressExpand 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ─── Hero Badge Pulse ────────────────────────────────────── */
@keyframes badgePulse {
    0%   { box-shadow: 0 0 0 0 rgba(155, 61, 18, 0.2); }
    70%  { box-shadow: 0 0 0 8px rgba(155, 61, 18, 0); }
    100% { box-shadow: 0 0 0 0 rgba(155, 61, 18, 0); }
}
.hero-badge {
    animation: badgePulse 3s ease infinite;
}

/* ─── Hover Lift for Info Cards ──────────────────────────── */
.lift-card {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s ease;
}
.lift-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(26, 20, 16, 0.10);
}

/* ─── Life Goals Layer Styles ────────────────────────────── */
.btn-life {
    background: var(--life-accent);
    color: #ffffff;
    cursor: pointer;
    text-align: center;
    border: none;
    border-radius: 8px;
    padding: 12px 28px;
    font-weight: 800;
    font-size: 15px;
    transition: background 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-block;
    box-shadow: 0 4px 12px rgba(26, 94, 60, 0.20);
    position: relative;
    overflow: hidden;
}
.btn-life::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.btn-life:hover::before { opacity: 1; }
.btn-life:hover {
    background: var(--life-accent-hover);
    box-shadow: 0 8px 28px rgba(26, 94, 60, 0.35);
    transform: translateY(-2px);
}
.btn-life:active {
    transform: translateY(1px) scale(0.98) !important;
}

.btn-life-outline {
    color: var(--life-accent);
    border: 1.5px solid var(--life-accent);
    cursor: pointer;
    text-align: center;
    background: transparent;
    border-radius: 8px;
    padding: 12px 28px;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-block;
}
.btn-life-outline:hover {
    background: var(--life-accent-light);
    transform: translateY(-2px);
}

.life-choice-btn {
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    border-radius: 12px;
    padding: 14px 18px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: right;
}
.life-choice-btn:hover {
    border-color: var(--life-accent);
    background: var(--life-accent-light);
    transform: translateX(-4px);
}
.life-choice-btn.selected {
    border-color: var(--life-accent);
    background: var(--life-accent);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(26, 94, 60, 0.25);
}

/* ============================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS (Tablet & Mobile)
   مخصص للأجهزة اللوحية والهواتف مع الحفاظ التام على الحاسوب
   ============================================================ */

/* ─── Navigation Classes ─── */
.desktop-nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--ink);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}
.mobile-menu-toggle:hover,
.mobile-menu-toggle:active {
    background: rgba(0, 0, 0, 0.05);
}

.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    top: 64px;
    background: rgba(26, 20, 16, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 48;
    opacity: 0;
    animation: fadeIn 0.25s ease forwards;
}

.mobile-nav-drawer {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
    z-index: 49;
    padding: 20px 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: drawerSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes drawerSlideDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--bg);
    color: var(--ink);
    font-weight: 700;
    font-size: 15px;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: right;
    transition: all 0.2s ease;
    width: 100%;
}
.mobile-nav-item:active,
.mobile-nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
    border-color: rgba(155, 61, 18, 0.2);
}

/* ─── Tablet & Mobile Media Queries (<= 768px) ─── */
@media screen and (max-width: 768px) {
    .desktop-nav-links {
        display: none !important;
    }
    
    .mobile-menu-toggle {
        display: flex !important;
    }

    /* Adjust Global Section Paddings */
    section {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    
    /* Typography on mobile */
    h1 {
        font-size: clamp(22px, 5.5vw, 32px) !important;
        line-height: 1.35 !important;
    }
    
    h2 {
        font-size: clamp(19px, 4.5vw, 24px) !important;
        line-height: 1.4 !important;
    }

    /* Assessment and Quiz View */
    .assessment-card {
        padding: 20px 16px !important;
    }

    /* Radar Chart on Results View */
    .radar-chart-container {
        height: 250px !important;
    }

    /* Buttons full width in action groups on mobile */
    .btn-mobile-block {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
    }

    /* Modal popups */
    .modal-content-box {
        max-width: 94vw !important;
        padding: 24px 18px !important;
    }
}

/* ─── Small Mobile Devices (<= 480px) ─── */
@media screen and (max-width: 480px) {
    body {
        font-size: 14.5px;
    }

    .btn-rust, .btn-gold, .btn-outline, .btn-life, .btn-life-outline {
        padding: 12px 20px;
        font-size: 14px;
    }

    /* Single Column Layouts on small screens */
    .responsive-grid-2,
    .responsive-grid-3 {
        grid-template-columns: 1fr !important;
    }

    /* Range slider touch optimization */
    input[type=range] {
        height: 10px;
        margin: 18px 0;
    }
    input[type=range]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    input[type=range]::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }

    /* 3D Book Cover perspective adjustment on small screen */
    .book-cover-3d {
        transform: rotateY(-10deg) rotateX(3deg) scale(0.95);
    }
}


