/* ==========================================
// 📁 File: assets/css/style.css (Part 1: Core & Animations)
// 🎯 Architecture: Minimalist, Monochrome, High-Contrast
// ========================================== */

/* --- 1. Root Variables & Design Tokens --- */
:root {
    /* پالت مونوکروم و پایه */
    --bg-pure-black: #000000;
    --text-primary: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.4);
    
    /* متغیرهای شیشه‌ای (Glassmorphism) با خطوط مویی */
    --glass-bg: rgba(10, 10, 10, 0.65);
    --glass-border: rgba(255, 255, 255, 0.15);
    
    /* سیستم رنگی نئون برای هشدارهای کینماتیک */
    --neon-green: #00ff88;
    --neon-red: #ff2a5f;
    --neon-yellow: #ffcc00;
    
    /* تایپوگرافی */
    --font-main: 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* زمان‌بندی انیمیشن‌ها */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

/* --- 2. CSS Reset & Mobile Optimization --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* جلوگیری از هایلایت شدن المان‌ها هنگام تاچ در موبایل */
    -webkit-tap-highlight-color: transparent; 
}

html, body {
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-pure-black);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden; /* قفل کردن اسکرول برای تجربه Native */
    overscroll-behavior: none; /* جلوگیری از رفرش شدن صفحه با کشیدن به پایین در کروم موبایل */
    font-weight: 400; /* وزن سبک برای حس مینیمال و حرفه‌ای */
}

/* پنهان کردن المان‌ها با یک کلاس استاندارد */
.hidden {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* --- 3. Keyframe Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes pulseRed {
    0% { box-shadow: inset 0 0 0px 0px rgba(255, 42, 95, 0); }
    50% { box-shadow: inset 0 0 60px 10px rgba(255, 42, 95, 0.6); }
    100% { box-shadow: inset 0 0 0px 0px rgba(255, 42, 95, 0); }
}

@keyframes slideUpCard {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes loadingBarFill {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* --- 4. Splash Screen (صفحه بارگذاری عمیق) --- */
#splash_screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-pure-black);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-in-out;
}

#splash_screen:not(.splash-active) {
    opacity: 0;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.splash-logo {
    font-size: 3.5rem;
    font-weight: 120; /* نازک‌ترین حالت ممکن */
    letter-spacing: 15px;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.splash-subtitle {
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 4px;
    color: var(--text-muted);
    margin-bottom: 4rem;
    text-transform: uppercase;
}

.loading-bar-container {
    width: 200px;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.loading-bar {
    height: 100%;
    background-color: var(--text-primary);
    width: 0%;
    animation: loadingBarFill 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.splash-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.splash-footer {
    padding-bottom: 3rem;
    font-size: 0.7rem;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
}

/* --- 5. Main Canvas & Video Container --- */
.video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-pure-black);
    z-index: 1;
}

#input_video {
    display: none; /* ویدیو خام مخفی می‌ماند */
}

#output_canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- 6. Sensory Overlays (افکت‌های حسی) --- */

/* فلش موفقیت */
#flash_overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--text-primary);
    opacity: 0;
    pointer-events: none;
    z-index: 9000;
    transition: opacity 0.05s ease-out; /* فلش بسیار سریع */
}

/* هاله قرمز رنگ دور صفحه هنگام خطای بحرانی */
#danger_vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 8500;
}

#danger_vignette:not(.hidden) {
    animation: pulseRed 0.8s infinite;
}

/* رنگ‌بندی‌های تکست برای خروجی‌های کینماتیک */
.text-green { color: var(--neon-green) !important; text-shadow: 0 0 10px rgba(0, 255, 136, 0.3); }
.text-red { color: var(--neon-red) !important; text-shadow: 0 0 10px rgba(255, 42, 95, 0.3); }
.text-yellow { color: var(--neon-yellow) !important; }

/* ==========================================
// 📁 File: assets/css/style.css (Part 2: HUD, Carousel & Modal)
// 🎯 Architecture: Glassmorphism & High-Contrast Data
// ========================================== */

/* --- 7. HUD (Heads-Up Display) Container --- */
.hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 10;
    pointer-events: none; /* عبور لمس از لایه کلی */
}

/* --- 8. HUD Header (Micro-branding & Status) --- */
.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.brand-micro {
    font-size: 0.65rem;
    letter-spacing: 5px;
    color: var(--text-muted);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.35rem 1rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

#ai_status_text {
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.dot.yellow { background-color: var(--neon-yellow); box-shadow: 0 0 5px var(--neon-yellow); }
.dot.green { background-color: var(--neon-green); box-shadow: 0 0 5px var(--neon-green); }
.dot.red { background-color: var(--neon-red); box-shadow: 0 0 5px var(--neon-red); }

/* --- 9. HUD Center (Giant Counter & Live Feedback) --- */
.hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

.counter-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

#rep_counter {
    font-size: 8rem;
    font-weight: 400; /* ضخامت مویی تایپوگرافی */
    line-height: 0.9;
    color: var(--text-primary);
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    transition: transform var(--transition-fast);
}

#rep_counter.pop {
    transform: scale(1.15); /* افکت بزرگ شدن لحظه‌ای هنگام ثبت تکرار */
}

.rep-label {
    font-size: 0.85rem;
    letter-spacing: 8px;
    color: var(--text-muted);
    margin-top: -10px;
}

.message-glass-box {
    background-color: rgba(0, 0, 0, 0.5);
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.75rem 2rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    max-width: 90%;
    text-align: center;
}

#feedback_message {
    font-size: 1.5rem;
    font-weight: 500;
}

/* --- 10. HUD Footer & Warnings --- */
.hud-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    pointer-events: auto !important;
    width: 100%;
}

.warning-capsule {
    background-color: rgba(255, 42, 95, 0.15);
    border: 1px solid var(--neon-red);
    color: var(--neon-red);
    padding: 0.5rem 1.5rem;
    font-size: 0.85rem;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(5px);
    box-shadow: 0 0 15px rgba(255, 42, 95, 0.2);
}

/* --- 11. Glassmorphism Exercise Selector --- */
.exercise-selector-container {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto !important;
    z-index: 50;
}

.glass-btn {
    background: rgba(10, 10, 10, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.8rem 2rem;
    border-radius: 40px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.glass-btn:active {
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.05);
}

.chevron-icon {
    width: 20px;
    height: 20px;
    transition: transform var(--transition-smooth);
}

.glass-btn.open .chevron-icon {
    transform: rotate(180deg);
}

.glass-menu {
    position: absolute;
    bottom: calc(100% + 15px);
    width: 85%;
    max-width: 320px;
    background: rgba(5, 5, 5, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transform-origin: bottom center;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    opacity: 1;
    transform: translateY(0) scale(1);
}

.glass-menu.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 1.2rem;
    border-radius: 15px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.menu-item:active {
    background: rgba(255, 255, 255, 0.05);
}

.menu-item.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.menu-icon {
    width: 24px;
    height: 24px;
}

/* --- 12. Minimal Action Buttons --- */
.action-btn {
    background-color: var(--text-primary);
    color: var(--bg-pure-black);
    border: none;
    padding: 1rem 3rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.action-btn:active {
    transform: scale(0.95);
    background-color: #e0e0e0;
}

.action-btn.outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.action-btn.outline:active {
    background-color: rgba(255, 255, 255, 0.1);
}

/* --- 13. Post-Workout Summary Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 9900;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    transition: opacity var(--transition-smooth);
}

.modal-glass-panel {
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 400px;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    animation: slideUpCard 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 300;
    letter-spacing: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* SVG Circular Chart (Biomechanical Score) */
.score-circle {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.circular-chart {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.circle-bg {
    fill: none;
    stroke: var(--glass-border);
    stroke-width: 1.5;
}

.circle {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: square; /* لبه‌های تیز به جای گرد */
    transition: stroke-dasharray 1.5s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.5s ease;
}

.score-number {
    font-size: 3.5rem;
    font-weight: 200;
    line-height: 1;
}

.score-label {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--text-muted);
}

/* Stats Grid */
.stats-grid {
    display: flex;
    width: 100%;
    gap: 1rem;
}

.stat-box {
    flex: 1;
    border: 1px solid var(--glass-border);
    padding: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 300;
}

.stat-name {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Insight Box */
.insight-box {
    width: 100%;
    border-top: 1px dashed var(--glass-border);
    padding-top: 1.5rem;
}

.insight-title {
    font-size: 0.75rem;
    color: var(--neon-yellow);
    margin-bottom: 0.5rem;
}

.insight-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}
