/* ============================================================================
   Copyright (c) 2026. All Rights Reserved.
   PROPRIETARY & CONFIDENTIAL.
   Unauthorized copying, modification, or distribution of this file is strictly prohibited.
============================================================================ */

/* Global & Variables */
:root {
    --bg-color: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #10b981; /* Emerald green for positive state */
    --alert: #ef4444; /* Red for mistakes */
    --font-main: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden; /* Prevent scrolling during camera usage */
    height: 100vh;
    width: 100vw;
}

/* Glassmorphism utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none !important;
}

/* Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.9);
    transition: opacity 0.3s ease;
}

/* Setup Screen */
.setup-card {
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setup-card h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.setup-card p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.prayer-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 15px 20px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.2s ease;
}

button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

#loading {
    color: var(--accent);
    font-weight: 600;
    margin-top: 15px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Video & Canvas Container */
#tracker-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#video-feed, #output-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Object-fit cover ensures it fills the screen without stretching */
    object-fit: cover;
}

/* Keep video hidden but rendering for MediaPipe */
#video-feed {
    opacity: 0;
    z-index: 1;
}

#output-canvas {
    z-index: 10;
}

/* Head-Up Display (HUD) */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none; /* Let clicks pass through to canvas if needed */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px;
}

#status-container {
    width: 100%;
    text-align: center;
    padding-top: 2vh;
}

.status-good {
    color: var(--accent);
}

.status-error {
    color: #f97316; /* Orange */
    animation: clignoting 1s infinite alternate;
}

@keyframes clignoting {
    0% { opacity: 1; text-shadow: 0 0 20px #f97316; }
    100% { opacity: 0.3; text-shadow: 0 0 5px #f97316; }
}

.prayer-title {
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
    padding: 0;
}

.rakaa-level {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ef4444;
}

#alert-banner {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 20px;
}

.posture-chip {
    align-self: center;
    padding: 15px 40px;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: 30px; /* Pill shape */
    background: var(--glass-bg);
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

#debug-console {
    display: none !important;
}

#log-output p {
    margin-bottom: 4px;
    color: #38bdf8;
    line-height: 1.2;
}

/* Quran Prompter Styles */
#quran-display {
    flex-grow: 1;
    padding: 20px 5%;
    height: 60vh;
    overflow-y: auto;
    text-align: center;
    scroll-behavior: smooth;
}

.quran-text {
    font-size: 5vh;
    line-height: 2;
    text-align: center;
    color: #f8fafc;
    font-family: 'Traditional Arabic', 'Amiri', 'Scheherazade New', serif;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.quran-text.active {
    opacity: 1;
    transform: translateY(0);
}

.quran-meta {
    font-size: 1.2rem;
    color: #38bdf8;
    margin-top: 15px;
    opacity: 0.8;
}

.quran-ayah {
    transition: color 0.5s ease, opacity 0.5s ease, text-shadow 0.5s ease;
    opacity: 0.5; /* Unread verses remain dimmed */
}

.quran-ayah.ayah-active {
    opacity: 1.0;
    color: #ffd700; /* Golden text for focus */
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
}

.quran-ayah.ayah-completed {
    opacity: 0.6;
    color: #4ade80; /* Soft green for finished! */
}

/* Specific Posture Styles optionally added via JS classes */
.posture-chip.qiyam { color: #f8fafc; }
.posture-chip.ruku { color: #38bdf8; }
.posture-chip.sujud { color: #818cf8; }
.posture-chip.juloos { color: #fbbf24; }

/* Alert Styles */
.red-glow {
    border-color: var(--alert);
    background: rgba(239, 68, 68, 0.15);
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.3);
}

.alert-card {
    padding: 50px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    pointer-events: auto; /* Buttons on alert need to be clickable */
}

.alert-title {
    color: var(--alert);
    font-size: 3rem;
    font-weight: 800;
}

#alert-message {
    font-size: 1.5rem;
}

.dismiss-btn {
    background: var(--alert);
    color: white;
    margin-top: 20px;
    align-self: center;
    padding: 15px 40px;
    border: none;
}
.dismiss-btn:hover {
    background: #dc2626;
}
