/* ===== Global Styles ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #1f2937;
    --light-bg: #f3f4f6;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

.main-content {
    min-height: calc(100vh - 200px);
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

.arabic-text {
    font-family: 'Amiri', serif;
    font-size: 1.5rem;
    line-height: 2;
    text-align: right;
    direction: rtl;
}

/* ===== Navbar ===== */
.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.bg-gradient-primary {
    background: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%) !important;
}

.navbar-brand {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover {
    transform: translateY(-2px);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

/* ===== Cards ===== */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-5px);
}

.card-game {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
}

.card-game:hover {
    transform: scale(1.02) translateY(-5px);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

/* ===== Buttons ===== */
.btn {
    border-radius: 10px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%);
}

.btn-success {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.btn-danger {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.btn-game {
    font-size: 1.2rem;
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* ===== Badges ===== */
.badge {
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 500;
}

/* ===== Progress Bars ===== */
.progress {
    height: 30px;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    transition: width 0.6s ease;
    font-weight: 600;
}

/* ===== Stats Cards ===== */
.stat-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.stat-icon.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-icon.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.stat-icon.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.stat-icon.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

/* ===== Timer ===== */
.timer-display {
    font-size: 4rem;
    font-weight: 700;
    color: #2563eb;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ===== Game Interface ===== */
.game-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.hadith-display {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    min-height: 300px;
}

.highlight-word {
    background-color: #fef3c7;
    padding: 2px 5px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.highlight-word:hover {
    background-color: #fcd34d;
}

/* ===== Video Webcam ===== */
#webcam-container {
    position: relative;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

#webcam {
    width: 100%;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
}

.eye-tracking-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-weight: 600;
}

.eye-tracking-indicator.tracking {
    background: #10b981;
}

.eye-tracking-indicator.not-tracking {
    background: #ef4444;
}

/* ===== Leaderboard ===== */
.leaderboard-item {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.leaderboard-item:hover {
    transform: translateX(5px);
    box-shadow: var(--card-shadow);
}

.rank-badge {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    margin-right: 1rem;
}

.rank-1 {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

.rank-2 {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    color: white;
}

.rank-3 {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    color: white;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in {
    animation: slideInRight 0.5s ease;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .timer-display {
        font-size: 2.5rem;
    }
    
    .arabic-text {
        font-size: 1.2rem;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .game-container {
        padding: 1rem;
    }
}

/* ===== Footer ===== */
.footer {
    margin-top: auto;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* ===== Alerts ===== */
.alert {
    border-radius: 10px;
    border: none;
}

/* ===== Loading Spinner ===== */
.spinner-border-custom {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}