/* ============================
   مسابقة الثقافة الرياضية المدرسية
   تصميم متطور - CSS
   ============================ */

:root {
    --primary: #1a6b3c;
    --primary-light: #2e8b57;
    --primary-dark: #0d4f2b;
    --gold: #d4af37;
    --gold-light: #f0d060;
    --gold-dark: #b8960c;
    --team1-color: #1565c0;
    --team1-light: #42a5f5;
    --team1-dark: #0d47a1;
    --team2-color: #c62828;
    --team2-light: #ef5350;
    --team2-dark: #b71c1c;
    --bg-cream: #f5f0e1;
    --text-dark: #1a1a2e;
    --text-light: #ffffff;
    --correct: #2e7d32;
    --wrong: #c62828;
    --shadow: 0 10px 40px rgba(0,0,0,0.2);
    --shadow-sm: 0 4px 15px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Cairo', 'Tajawal', sans-serif;
    background: var(--bg-cream);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    direction: rtl;
}

/* Background */
.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(135deg, rgba(26,107,60,0.03) 0%, rgba(212,175,55,0.05) 50%, rgba(26,107,60,0.03) 100%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%231a6b3c' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: 0;
    pointer-events: none;
}

.numbers-section {
    position: relative;
    z-index: 10;
    max-width: 650px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

/* Legacy full-page watermark (admin may use) */
.watermark-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.watermark-logo {
    width: 55%;
    max-width: 550px;
    min-width: 280px;
    height: auto;
    opacity: 0.04;
    filter: grayscale(30%);
    user-select: none;
    -webkit-user-drag: none;
}

/* Decorative top border like the Canva design */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: repeating-linear-gradient(
        90deg,
        var(--primary) 0px,
        var(--primary) 20px,
        var(--gold) 20px,
        var(--gold) 40px,
        var(--primary-light) 40px,
        var(--primary-light) 60px
    );
    z-index: 1000;
}

#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
    animation: floatParticle 15s infinite ease-in-out;
}

@keyframes floatParticle {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-30px) rotate(90deg); }
    50% { transform: translateY(-10px) rotate(180deg); }
    75% { transform: translateY(-40px) rotate(270deg); }
}

/* ====== HEADER ====== */
.main-header {
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, var(--bg-cream) 0%, #efe8d4 100%);
    padding: 20px 30px;
    border-bottom: 3px solid var(--gold);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.header-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.header-logo {
    height: 70px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.header-title {
    text-align: center;
}

.header-title h1 {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-dark);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
    line-height: 1.4;
}

.header-title p {
    font-size: 1rem;
    color: var(--primary);
    font-weight: 700;
    margin-top: 2px;
}

/* ====== SCOREBOARD ====== */
.scoreboard {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 25px 20px;
    max-width: 800px;
    margin: 20px auto;
}

.team {
    flex: 1;
    max-width: 300px;
    text-align: center;
    padding: 20px 15px;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
}

.team::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.1;
    border-radius: 20px;
}

.team:hover {
    transform: translateY(-5px) scale(1.02);
}

.team-1 {
    background: linear-gradient(135deg, var(--team1-color), var(--team1-dark));
    box-shadow: 0 10px 30px rgba(21,101,192,0.3);
    color: white;
}

.team-2 {
    background: linear-gradient(135deg, var(--team2-color), var(--team2-dark));
    box-shadow: 0 10px 30px rgba(198,40,40,0.3);
    color: white;
}

/* ====== TEAM LOGOS ====== */
.team-logo-wrapper {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    margin: 0 auto 10px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid rgba(255,255,255,0.4);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.team:hover .team-logo-wrapper {
    border-color: rgba(255,255,255,0.7);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    transform: scale(1.05);
}

.team-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.team-logo-fallback {
    font-size: 1.8rem;
    opacity: 0.8;
    color: white;
}

.team-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
    opacity: 0.8;
}

/* Team Select Modal Logos */
.team-select-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid rgba(255,255,255,0.3);
    margin: 0 auto;
}

.team-select-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.team-select-logo-fallback {
    font-size: 2rem;
    color: white;
    opacity: 0.9;
}

/* Winner Logo */
.winner-logo-container {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 15px;
    overflow: hidden;
    border: 4px solid var(--gold);
    box-shadow: 0 5px 25px rgba(212,175,55,0.4);
    animation: winnerLogoGlow 2s infinite alternate;
}

.winner-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

@keyframes winnerLogoGlow {
    0% { box-shadow: 0 5px 25px rgba(212,175,55,0.4); }
    100% { box-shadow: 0 5px 40px rgba(212,175,55,0.8), 0 0 60px rgba(212,175,55,0.3); }
}

.team-name {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.team-score {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.team-score.animate {
    animation: scoreJump 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scoreJump {
    0% { transform: scale(1); }
    30% { transform: scale(1.5); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.team-label {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 5px;
    font-weight: 600;
}

.vs-badge {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1rem;
    color: white;
    box-shadow: 0 5px 20px rgba(212,175,55,0.4);
    flex-shrink: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    animation: vsGlow 2s infinite alternate;
}

@keyframes vsGlow {
    0% { box-shadow: 0 5px 20px rgba(212,175,55,0.4); }
    100% { box-shadow: 0 5px 35px rgba(212,175,55,0.7); }
}

/* Team active glow */
.team.active-team {
    animation: teamGlow 1.5s infinite alternate;
}

.team-1.active-team {
    box-shadow: 0 0 30px rgba(21,101,192,0.6), 0 0 60px rgba(21,101,192,0.3);
}

.team-2.active-team {
    box-shadow: 0 0 30px rgba(198,40,40,0.6), 0 0 60px rgba(198,40,40,0.3);
}

/* ====== TURN INDICATOR ====== */
.turn-indicator {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 12px 30px;
    margin: 0 auto 20px;
    width: fit-content;
    background: white;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-dark);
    border: 2px solid var(--gold);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: turnPulse 2s infinite;
}

@keyframes turnPulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(212,175,55,0.2); }
    50% { box-shadow: 0 4px 25px rgba(212,175,55,0.5); }
}

.turn-indicator i {
    color: var(--gold);
    font-size: 1.3rem;
    animation: pointBounce 1s infinite;
}

@keyframes pointBounce {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-8px); }
}

/* ====== NUMBERS GRID ====== */
.numbers-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.number-cell {
    aspect-ratio: 1;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 900;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: linear-gradient(145deg, var(--primary-light), var(--primary-dark));
    color: white;
    box-shadow: 0 6px 20px rgba(26,107,60,0.3);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.number-cell::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    transform: rotate(45deg);
    transition: all 0.5s;
}

.number-cell:hover:not(.used):not(.disabled) {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 15px 40px rgba(26,107,60,0.4);
}

.number-cell:hover:not(.used):not(.disabled)::before {
    top: -30%;
    left: -30%;
}

.number-cell:active:not(.used):not(.disabled) {
    transform: translateY(-2px) scale(0.98);
}

.number-cell.used {
    background: linear-gradient(145deg, #78909c, #546e7a);
    cursor: default;
    opacity: 0.3;
    transform: scale(0.9);
    box-shadow: none;
    pointer-events: none;
}

.number-cell.used::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    font-size: 1.5rem;
    color: rgba(255,255,255,0.5);
}

.number-cell.disappearing {
    animation: cellDisappear 0.8s forwards;
}

@keyframes cellDisappear {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2) rotateY(90deg); opacity: 0.5; }
    100% { transform: scale(0) rotateY(180deg); opacity: 0; }
}

/* Numbered colors cycling */
.number-cell:nth-child(5n+1) { background: linear-gradient(145deg, #1565c0, #0d47a1); box-shadow: 0 6px 20px rgba(21,101,192,0.3); }
.number-cell:nth-child(5n+2) { background: linear-gradient(145deg, #2e7d32, #1b5e20); box-shadow: 0 6px 20px rgba(46,125,50,0.3); }
.number-cell:nth-child(5n+3) { background: linear-gradient(145deg, #c62828, #b71c1c); box-shadow: 0 6px 20px rgba(198,40,40,0.3); }
.number-cell:nth-child(5n+4) { background: linear-gradient(145deg, #6a1b9a, #4a148c); box-shadow: 0 6px 20px rgba(106,27,154,0.3); }
.number-cell:nth-child(5n+5) { background: linear-gradient(145deg, #e65100, #bf360c); box-shadow: 0 6px 20px rgba(230,81,0,0.3); }

/* ====== MODALS ====== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: overlayFadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 25px;
    padding: 35px;
    max-width: 600px;
    width: 100%;
    position: relative;
    box-shadow: 0 25px 80px rgba(0,0,0,0.3);
    animation: modalEnter 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalEnter {
    0% { transform: scale(0.5) translateY(50px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ====== TIMER ====== */
.timer-container {
    text-align: center;
    margin-bottom: 20px;
}

.timer-ring {
    width: 100px;
    height: 100px;
    margin: 0 auto 8px;
    position: relative;
}

.timer-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.5s ease;
}

.timer-progress.warning {
    stroke: #ff9800;
}

.timer-progress.danger {
    stroke: #f44336;
    animation: timerPulse 0.5s infinite alternate;
}

@keyframes timerPulse {
    0% { stroke-opacity: 1; }
    100% { stroke-opacity: 0.5; }
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
    transition: color 0.3s;
}

.timer-text.warning { color: #ff9800; }
.timer-text.danger { color: #f44336; animation: timerTextPulse 0.5s infinite alternate; }

@keyframes timerTextPulse {
    0% { transform: translate(-50%, -50%) scale(1); }
    100% { transform: translate(-50%, -50%) scale(1.2); }
}

.timer-label {
    font-size: 0.85rem;
    color: #888;
    font-weight: 600;
}

/* ====== QUESTION ====== */
.question-number-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: white;
    padding: 5px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.question-text {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 25px;
    line-height: 1.8;
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-btn {
    padding: 15px 20px;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    background: white;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: right;
    color: var(--text-dark);
}

.answer-btn:hover:not(.disabled) {
    border-color: var(--primary);
    background: rgba(26,107,60,0.05);
    transform: translateX(-5px);
}

.answer-btn .answer-letter {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1rem;
    flex-shrink: 0;
}

.answer-btn.correct {
    border-color: var(--correct);
    background: rgba(46,125,50,0.1);
    animation: correctPulse 0.6s ease;
}

.answer-btn.correct .answer-letter {
    background: var(--correct);
}

.answer-btn.wrong {
    border-color: var(--wrong);
    background: rgba(198,40,40,0.1);
    animation: wrongShake 0.6s ease;
}

.answer-btn.wrong .answer-letter {
    background: var(--wrong);
}

.answer-btn.disabled {
    cursor: default;
    opacity: 0.6;
}

.answer-btn.show-correct {
    border-color: var(--correct);
    background: rgba(46,125,50,0.15);
}

.answer-btn.show-correct .answer-letter {
    background: var(--correct);
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.05); }
    60% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(5px); }
}

/* Question Result */
.question-result {
    display: none;
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    border-radius: 15px;
    animation: resultFadeIn 0.5s ease;
}

.question-result.show {
    display: block;
}

.question-result.correct {
    background: rgba(46,125,50,0.1);
    border: 2px solid var(--correct);
}

.question-result.wrong {
    background: rgba(198,40,40,0.1);
    border: 2px solid var(--wrong);
}

.question-result.timeout {
    background: rgba(255,152,0,0.1);
    border: 2px solid #ff9800;
}

.question-result .result-icon {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.question-result .result-text {
    font-size: 1.1rem;
    font-weight: 700;
}

@keyframes resultFadeIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ====== TEAM SELECT MODAL ====== */
.team-select-content {
    text-align: center;
}

.team-select-content h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 25px;
}

.team-select-content h2 i {
    color: var(--gold);
    margin-left: 8px;
}

.team-select-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.team-select-btn {
    flex: 1;
    min-width: 180px;
    padding: 25px 20px;
    border: none;
    border-radius: 20px;
    font-family: 'Cairo', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.team-select-btn i {
    font-size: 2rem;
}

.team1-btn {
    background: linear-gradient(135deg, var(--team1-color), var(--team1-dark));
    box-shadow: 0 8px 25px rgba(21,101,192,0.3);
}

.team2-btn {
    background: linear-gradient(135deg, var(--team2-color), var(--team2-dark));
    box-shadow: 0 8px 25px rgba(198,40,40,0.3);
}

.team-select-btn:hover {
    transform: translateY(-5px) scale(1.03);
}

.team1-btn:hover {
    box-shadow: 0 15px 40px rgba(21,101,192,0.5);
}

.team2-btn:hover {
    box-shadow: 0 15px 40px rgba(198,40,40,0.5);
}

/* ====== WINNER MODAL ====== */
.winner-modal-content {
    text-align: center;
    background: linear-gradient(135deg, #fff9e6, #ffffff, #fff9e6);
    border: 3px solid var(--gold);
    overflow: hidden;
    position: relative;
}

.winner-trophy {
    font-size: 5rem;
    color: var(--gold);
    margin-bottom: 15px;
    animation: trophyBounce 1s infinite alternate cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 5px 15px rgba(212,175,55,0.4));
}

@keyframes trophyBounce {
    0% { transform: translateY(0) rotate(-5deg); }
    100% { transform: translateY(-15px) rotate(5deg); }
}

.winner-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.winner-team-name {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.winner-score {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gold-dark);
    margin-bottom: 15px;
}

.winner-stars {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.winner-stars i {
    font-size: 1.8rem;
    color: var(--gold);
    animation: starTwinkle 1.5s infinite alternate;
}

.winner-stars i:nth-child(2) { animation-delay: 0.2s; }
.winner-stars i:nth-child(3) { animation-delay: 0.4s; }
.winner-stars i:nth-child(4) { animation-delay: 0.6s; }
.winner-stars i:nth-child(5) { animation-delay: 0.8s; }

@keyframes starTwinkle {
    0% { transform: scale(1) rotate(0deg); opacity: 0.7; }
    100% { transform: scale(1.3) rotate(20deg); opacity: 1; }
}

.winner-message {
    font-size: 1rem;
    color: #666;
    font-weight: 600;
    margin-bottom: 20px;
}

.btn-restart {
    padding: 12px 35px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 50px;
    font-family: 'Cairo', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(26,107,60,0.3);
}

.btn-restart:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(26,107,60,0.4);
}

.btn-restart i {
    margin-left: 8px;
}

/* ====== CONFETTI CANVAS ====== */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* ====== ADMIN LINK ====== */
.admin-link {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    text-decoration: none;
    box-shadow: 0 5px 20px rgba(26,107,60,0.3);
    transition: all 0.3s ease;
    z-index: 100;
}

.admin-link:hover {
    transform: translateY(-3px) rotate(90deg);
    box-shadow: 0 8px 30px rgba(26,107,60,0.5);
}

/* ============================
   ADMIN PAGE STYLES
   ============================ */
.admin-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 10;
}

.admin-header {
    text-align: center;
    padding: 30px;
    margin-bottom: 30px;
}

.admin-header h1 {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.admin-header p {
    color: #666;
    font-weight: 600;
}

/* شعارات داخل لوحة التحكم */
.admin-panel-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #fafafa 0%, #f5f0e1 100%);
    border-radius: 16px;
    border: 1px solid rgba(26,107,60,0.15);
}

.admin-panel-logo-wrap {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-panel-logo {
    max-width: 70px;
    max-height: 70px;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.08));
}

.admin-panel-logos-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.admin-panel-logos-title span:first-child {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-dark);
}

.admin-panel-logos-sub {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
}

.admin-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
}

.admin-card h2 {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-card h2 i {
    color: var(--primary);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    transition: border-color 0.3s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(26,107,60,0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26,107,60,0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--wrong), #b71c1c);
    color: white;
    box-shadow: 0 4px 15px rgba(198,40,40,0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(198,40,40,0.4);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(212,175,55,0.3);
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212,175,55,0.4);
}

.btn-sm {
    padding: 8px 15px;
    font-size: 0.85rem;
}

.question-list {
    list-style: none;
}

.question-item {
    padding: 15px;
    border: 2px solid #eee;
    border-radius: 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s;
    background: #fafafa;
}

.question-item:hover {
    border-color: var(--primary);
    background: white;
}

.question-item .q-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    flex-shrink: 0;
}

.question-item .q-text {
    flex: 1;
    font-weight: 600;
    color: var(--text-dark);
}

.question-item .q-actions {
    display: flex;
    gap: 8px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.back-link:hover {
    color: var(--primary-dark);
    transform: translateX(5px);
}

/* ====== Admin Gate (رقم سري) ====== */
.admin-gate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.admin-gate-box {
    background: white;
    border-radius: 24px;
    padding: 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    border: 2px solid var(--gold);
    animation: gateBoxIn 0.4s ease;
}

.admin-gate-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.admin-gate-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.1));
}

.admin-gate-logos-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary);
}

@keyframes gateBoxIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.admin-gate-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.8rem;
}

.admin-gate-box h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.admin-gate-box > p {
    color: #666;
    font-weight: 600;
    margin-bottom: 22px;
}

.admin-gate-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-gate-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    font-family: 'Cairo', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: border-color 0.3s;
}

.admin-gate-input:focus {
    border-color: var(--primary);
}

.admin-gate-error {
    color: var(--wrong);
    font-weight: 700;
    font-size: 0.9rem;
    margin: 0;
    min-height: 20px;
}

.admin-gate-btn {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
}

/* Timer setting */
.timer-setting {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timer-setting input {
    width: 100px !important;
    text-align: center;
}

/* Alert messages */
.alert {
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    font-weight: 600;
    display: none;
    animation: alertSlide 0.3s ease;
}

.alert.show {
    display: block;
}

.alert-success {
    background: rgba(46,125,50,0.1);
    color: var(--correct);
    border: 1px solid var(--correct);
}

.alert-error {
    background: rgba(198,40,40,0.1);
    color: var(--wrong);
    border: 1px solid var(--wrong);
}

@keyframes alertSlide {
    0% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Answer options in admin */
.answer-options-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.answer-option-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.answer-option-item input[type="text"] {
    flex: 1;
}

.answer-option-item input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.correct-label {
    font-size: 0.8rem;
    color: var(--correct);
    font-weight: 700;
}

/* ====== LOGO UPLOAD AREA (Admin) ====== */
.logo-upload-area {
    border: 2px dashed #d0d0d0;
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    background: #fafafa;
}

.logo-upload-area:hover {
    border-color: var(--primary);
    background: rgba(26,107,60,0.02);
}

.logo-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(26,107,60,0.05);
    transform: scale(1.02);
}

.logo-preview-container {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    margin: 0 auto 12px;
    overflow: hidden;
    background: #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #d0d0d0;
    transition: all 0.3s;
}

.logo-preview-container:hover {
    border-color: var(--primary-light);
}

.logo-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.logo-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #aaa;
}

.logo-preview-placeholder i {
    font-size: 1.5rem;
}

.logo-preview-placeholder span {
    font-size: 0.65rem;
    font-weight: 600;
}

.logo-upload-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-title h1 { font-size: 1.3rem; }
    .header-logo { height: 50px; }
    .header-logos { gap: 15px; }

    .admin-gate-logos { gap: 10px; flex-wrap: wrap; }
    .admin-gate-logo { height: 40px; }
    .admin-gate-logos-title { font-size: 0.9rem; width: 100%; order: -1; margin-bottom: 4px; }

    .admin-panel-logos { flex-wrap: wrap; gap: 12px; padding: 15px; }
    .admin-panel-logo-wrap { width: 56px; height: 56px; }
    .admin-panel-logo { max-width: 56px; max-height: 56px; }
    .admin-panel-logos-title span:first-child { font-size: 0.95rem; }
    .admin-panel-logos-sub { font-size: 0.8rem; }
    
    .scoreboard { flex-direction: column; gap: 15px; }
    .team { max-width: 100%; }
    .vs-badge { display: none; }
    
    .numbers-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .number-cell { font-size: 1.5rem; }
    
    .modal-content { padding: 25px 20px; }
    .question-text { font-size: 1.1rem; }
    
    .form-row { grid-template-columns: 1fr; }
    .answer-options-group { grid-template-columns: 1fr; }
    
    .team-select-buttons { flex-direction: column; }
}

@media (max-width: 480px) {
    .numbers-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .header-title h1 { font-size: 1.1rem; }
    .winner-title { font-size: 1.6rem; }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}
