/**
 * style.css — شفرة عبقر
 * ======================
 * جميع الأنماط المخصصة للتطبيق
 */

/* --- الخطوط --- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');

@font-face {
    font-family: 'AAGalaxy';
    src: url('../../fonts/AA-GALAXY.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* --- الأساس --- */
body {
    font-family: 'AAGalaxy', 'Cairo', sans-serif;
    background-color: #f4f2f7;
    background-image: radial-gradient(at top right, #fdfbfd, #f4f2f7);
    background-attachment: fixed;
    margin: 0;
    padding: 0;
    color: #111827;
    direction: rtl;
}

.font-galaxy {
    font-family: 'AAGalaxy', 'Cairo', sans-serif;
}

/* --- Glassmorphism --- */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

/* --- الأنيميشن --- */
@keyframes pop {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); opacity: 1; }
}
.animate-pop {
    animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes float-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-float-up {
    animation: float-up 0.4s ease-out forwards;
}

@keyframes confetti-fall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 50;
    animation: confetti-fall 3s linear infinite;
    border-radius: 50%;
    pointer-events: none;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(115, 64, 143, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(115, 64, 143, 0); }
}
.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* --- بطاقة الكلمة --- */
.card {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 60px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    user-select: none;
    text-align: center;
    padding: 0.5rem;
    font-weight: 700;
    border-bottom-width: 3px;
    cursor: pointer;
}

.card:not(.revealed):not(.spymaster-view):hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

.card:not(.revealed):not(.spymaster-view):active {
    transform: scale(0.95);
}

.card.revealed {
    cursor: default;
}

.card.locked {
    cursor: default;
    pointer-events: none;
}

/* --- ألوان البطاقات (مكشوفة) --- */
.card.revealed.type-red {
    background: linear-gradient(to bottom right, #ef4444, #dc2626);
    color: white;
    border-color: rgba(185, 28, 28, 0.5);
}
.card.revealed.type-blue {
    background: linear-gradient(to bottom right, #3b82f6, #2563eb);
    color: white;
    border-color: rgba(30, 64, 175, 0.5);
}
.card.revealed.type-green {
    background: linear-gradient(to bottom right, #22c55e, #16a34a);
    color: white;
    border-color: rgba(21, 128, 61, 0.5);
}
.card.revealed.type-yellow {
    background: linear-gradient(to bottom right, #facc15, #eab308);
    color: #713f12;
    border-color: rgba(202, 138, 4, 0.5);
}
.card.revealed.type-black {
    background: linear-gradient(to bottom right, #1f2937, #111827);
    color: white;
    border-color: black;
}
.card.revealed.type-neutral {
    background: linear-gradient(to bottom right, #e5e7eb, #d1d5db);
    color: #6b7280;
    border-color: rgba(156, 163, 175, 0.3);
}

/* --- وضع القائد (Spymaster) --- */
.card.spymaster-view.type-red { background: #fef2f2; color: #991b1b; border: 2px solid rgba(252, 165, 165, 0.5); }
.card.spymaster-view.type-blue { background: #eff6ff; color: #1e40af; border: 2px solid rgba(147, 197, 253, 0.5); }
.card.spymaster-view.type-green { background: #f0fdf4; color: #166534; border: 2px solid rgba(134, 239, 172, 0.5); }
.card.spymaster-view.type-yellow { background: #fefce8; color: #854d0e; border: 2px solid rgba(253, 224, 71, 0.5); }
.card.spymaster-view.type-black { background: #e5e7eb; color: #111827; border: 2px solid rgba(107, 114, 128, 0.5); }
.card.spymaster-view.type-neutral { background: white; color: #9ca3af; border: 2px solid rgba(243, 244, 246, 1); }

/* --- البطاقة العادية (غير مكشوفة) --- */
.card.normal {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03), 0 -2px 10px rgba(255,255,255,1) inset;
}

/* --- المودال --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2.5rem;
    border-radius: 2.5rem;
    text-align: center;
    max-width: 32rem;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.5);
}


/* --- أحجام نص البطاقات --- */
.grid-5 .card { font-size: 1rem; }
.grid-6 .card { font-size: 0.875rem; }
.grid-7 .card { font-size: 0.75rem; }

@media (min-width: 640px) {
    .grid-5 .card { font-size: 1.125rem; }
    .grid-6 .card { font-size: 1rem; }
    .grid-7 .card { font-size: 0.875rem; }
}

@media (min-width: 1024px) {
    .card { min-height: 100px; border-bottom-width: 5px; border-radius: 1rem; }
    .grid-5 .card { font-size: 1.5rem; }
    .grid-6 .card { font-size: 1.25rem; }
    .grid-7 .card { font-size: 1.125rem; }
}

/* --- إخفاء/إظهار الشاشات --- */
.screen { display: none; }
.screen.active { display: flex; }

/* --- مؤشرات الحالة --- */
.status-badge {
    position: absolute;
    top: -0.75rem;
    right: -0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 20;
}

/* --- إعدادات الأزرار --- */
.setup-toggle {
    flex: 1;
    padding: 0.75rem;
    border-radius: 0.75rem;
    font-weight: 700;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}
.setup-toggle.active {
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    color: #73408f;
    transform: scale(1.02);
}
.setup-toggle:not(.active) {
    color: #6b7280;
}
.setup-toggle:not(.active):hover {
    color: #374151;
    background: rgba(229, 231, 235, 0.5);
}

/* --- لوحة النتيجة --- */
.score-badge {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 70px;
    padding: 0.5rem 0.5rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}
.score-badge.active-turn {
    ring: 4px;
    transform: scale(1.1);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 10;
}
.score-badge.eliminated {
    filter: grayscale(1);
    opacity: 0.5;
}

@media (min-width: 768px) {
    .score-badge { min-width: 110px; padding: 0.5rem 0.75rem; }
}

/* --- قائمة الكلمات (المودال) --- */
.words-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    padding: 1rem;
}

.words-modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 1.5rem;
    border-radius: 2rem;
    width: 100%;
    max-width: 80rem;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.5);
}
