/* Force light mode and prevent browser/system dark mode */
:root {
    color-scheme: light only;
}

/* Global gradient text fixes */
[class*="gradient-text"] {
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

/* Base styles */
body {
    font-family: 'Cairo', sans-serif;
    background-color: #f8fafc; /* slate-50 */
    transition: background 0.5s ease-in-out;
    overflow-x: hidden;
    forced-color-adjust: none;
}
html { scroll-behavior: smooth; }
.theme-bg-container { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; display: none; transition: opacity 0.5s ease-in-out; opacity: 0; pointer-events: none; }
.theme-bg-container.active { display: block; opacity: 1; }
.theme-bg-container.interactive { pointer-events: auto; }
header { 
    background-color: rgba(255, 255, 255, 0.8); 
    backdrop-filter: blur(10px); 
    border-color: #e2e8f0; 
    transition: transform 0.3s ease-in-out;
}

.header-hidden {
    transform: translateY(-100%);
}
.main-gradient-text { 
    background: linear-gradient(to right, #3b82f6, #1e40af); 
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 0.5rem); background-color: white; border-radius: 0.75rem; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); border: 1px solid #e5e7eb; z-index: 50; min-width: 220px; transition: all 0.3s ease-in-out; transform-origin: top right; }
.dropdown-menu.hidden { transform: scale(0.95); opacity: 0; pointer-events: none; }

.lecture-card { background-color: white; border: 1px solid #e5e7eb; border-radius: 1.5rem; padding: 1.25rem; display: flex; flex-direction: column; text-align: center; transition: all 0.3s ease-in-out; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
.action-btn { display: block; width: 100%; text-align: center; text-decoration: none; font-weight: 700; padding: 0.75rem 1rem; border-radius: 0.75rem; transition: all 0.2s ease-in-out; }
.action-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.resource-pill { padding-left: 0.75rem; padding-right: 0.75rem; padding-top: 0.25rem; padding-bottom: 0.25rem; font-size: 0.875rem; line-height: 1.25rem; font-weight: 600; border-radius: 9999px; transition: all 0.2s ease-in-out; }
.info-box { background-color: white; border-radius: 1rem; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); border: 1px solid #e2e8f0; padding: 1.5rem; }

/* Keyframes */
@keyframes nebula-flow { 0%{background-position:0% 50%} 50%{background-position:100% 50%} 100%{background-position:0% 50%} }
@keyframes wave-flow { 0%{transform:translateX(0)} 100%{transform:translateX(-50%)} }
@keyframes twinkle { 0%,100%{opacity:0} 50%{opacity:1} }
@keyframes shooting-star { 0% { transform: translateX(300vw) translateY(-50vh) rotate(225deg); opacity: 1; } 100% { transform: translateX(-50vw) translateY(100vh) rotate(225deg); opacity: 0; } }
@keyframes crystal-rotate { from { transform: rotate(0deg) scale(1); } to { transform: rotate(360deg) scale(1); } }
@keyframes garden-dream-flow { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* --- Theme System --- */
html[class*="theme-"] body { color: #e5e5e5; }
html[class*="theme-"] header { background-color: rgba(18, 18, 18, 0.7); border-color: rgba(255, 255, 255, 0.1); }
html[class*="theme-"] .dropdown-menu { background-color: rgba(25, 25, 25, 0.8); border-color: rgba(255, 255, 255, 0.15); backdrop-filter: blur(10px); }
html[class*="theme-"] .dropdown-menu a, html[class*="theme-"] .dropdown-menu button { color: #d4d4d4; }
html[class*="theme-"] .dropdown-menu a:hover, html[class*="theme-"] .dropdown-menu button:hover { background-color: rgba(255, 255, 255, 0.05); }
html[class*="theme-"] #logout-btn:hover { color: #ef4444; background-color: rgba(239, 68, 68, 0.1); }
html[class*="theme-"] .text-slate-800, html[class*="theme-"] .text-slate-900, html[class*="theme-"] .text-slate-600, html[class*="theme-"] .font-semibold, html[class*="theme-"] .text-slate-500 { color: #d4d4d4; }

html[class*="theme-"] .info-box, html[class*="theme-"] .lecture-card { background-color: rgba(28, 28, 28, 0.5); border-color: rgba(255, 255, 255, 0.1); }
html[class*="theme-"] .info-box p, html[class*="theme-"] .info-box li, html[class*="theme-"] .info-box a { color: #a3a3a3; }
html[class*="theme-"] .info-box a:hover { color: #e5e5e5; }
html[class*="theme-"] .lecture-card:hover { border-color: rgba(147, 197, 253, 0.5); }
html[class*="theme-"] .border-t, html[class*="theme-"] hr { border-color: rgba(255, 255, 255, 0.1) !important; }

html[class*="theme-"] .border-sky-200 { border-color: rgba(56, 189, 248, 0.3); }
html[class*="theme-"] .border-teal-200 { border-color: rgba(45, 212, 191, 0.3); }
html[class*="theme-"] .border-indigo-200 { border-color: rgba(129, 140, 248, 0.3); }
html[class*="theme-"] .bg-amber-50 { background-color: rgba(252, 211, 77, 0.05); }
html[class*="theme-"] .border-amber-300 { border-color: rgba(252, 211, 77, 0.2); }
html[class*="theme-"] .text-amber-800 { color: #fde68a; }
html[class*="theme-"] .text-amber-700 { color: #fef3c7; }

/* Button Theme Adjustments */
html[class*="theme-"] .pill-pdf { background-color: rgba(239, 68, 68, 0.2); color: #fca5a5; }
html[class*="theme-"] .pill-rec { background-color: rgba(100, 116, 139, 0.2); color: #cbd5e1; }
html[class*="theme-"] .pill-matrix { background-color: rgba(34, 197, 94, 0.2); color: #86efac; }
html[class*="theme-"] .elec-lectures { background-color: rgba(14, 165, 233, 0.2); color: #7dd3fc; }
html[class*="theme-"] .elec-vlabs { background-color: rgba(20, 184, 166, 0.2); color: #5eead4; }
html[class*="theme-"] .elec-labs { background-color: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
html[class*="theme-"] .bg-purple-600 { background-color: #7e22ce; }

/* Theme: Golden Charcoal */
html.theme-golden-charcoal body { background-color: #121212; }
.theme-golden-charcoal #bg-golden-charcoal { background-image: radial-gradient(ellipse 80% 80% at 5% 50%,hsla(40,90%,55%,.15) 0,transparent 50%),radial-gradient(ellipse 80% 80% at 95% 50%,hsla(38,90%,55%,.15) 0,transparent 50%),url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIj48ZmlsdGVyIGlkPSJub2lzZSI+PGZlVHVyYnVsZW5jZSB0eXBlPSJmcmFjdGFsTm9pc2UiIGJhc2VGcmVxdWVuY3k9IjAuNzUiIG51bU9jdGF2ZXM9IjIiIHN0aXRjaFRpbGVzPSJzdGl0Y2giLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWx0ZXI9InVybCgjbm9pc2UpIiBvcGFjaXR5PSIwLjAyNSIvPjwvc3ZnPg=='); }
.theme-golden-charcoal .main-gradient-text { 
    background: linear-gradient(to right, #f59e0b, #fbbf24); 
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Theme: Space */
html.theme-space body { background-color: #000; }
.theme-space #bg-space::before { content:''; position:absolute; width:200%; height:200%; top:-50%; left:-50%; z-index:1; background:radial-gradient(circle,hsla(260,100%,80%,.3) 0,hsla(330,100%,80%,.2) 40%,transparent 70%); animation:nebula-flow 45s linear infinite; }
.theme-space #bg-space::after { content:''; position:absolute; top:0; left:0; right:0; bottom:0; z-index:0; background-image:url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAwIiBoZWlnaHQ9IjIwMDAiPjxkZWZzPjxyYWRpYWxHcmFkaWVudCBpZD0iZ3JhZCIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iNTAlIj48c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjZmZmZmZmIiBzdG9wLW9wYWNpdHk9IjEiLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMCIvPjwvcmFkaWFsR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9ImJsYWNrIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCwwKSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjIiIGhlaWdodD0iMiIgZmlsbD0idXJsKCNncmFkKSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg1MDAsMjAwKSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEuNSIgaGVpZ2h0PSIxLjUiIGZpbGw9InVybCgjZ3JhZCkiLz48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTUwMCwxODAwKSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkKSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMDAwLDEwMDApIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMS4yIiBoZWlnaHQ9IjEuMiIgZmlsbD0idXJsKCNncmFkKSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg4MDAsMTYwMCkiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIwLjgiIGhlaWdodD0iMC44IiBmaWxsPSJ1clIoI2dyYWQpIi8+PC9nPjwvZz48L3N2Zz4=') }
.star { position:absolute; background-color:#fff; border-radius:50%; animation-name:twinkle; animation-timing-function:ease-in-out; animation-iteration-count:infinite }
.shooting-star { position:fixed; width:2px; height:100px; background:linear-gradient(to top,transparent,#fff); animation-name:shooting-star; animation-timing-function:linear; animation-iteration-count:infinite; z-index:0 }
.theme-space .main-gradient-text { 
    background: linear-gradient(to right, #a78bfa, #f472b6); 
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Theme: Ocean */
html.theme-ocean body { background-color: #020617; }
.wave { position:absolute; left:0; bottom:0; width:200%; height:100vh; background-repeat:repeat-x; background-position: bottom; }
#wave1 { background-image:url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjAwIDMwMCI+PHBhdGggZmlsbD0iIzA4MmY0OSIgb3BhY2l0eT0iMC41IiBkPSJNMCAyNTBDMzAwIDMwMCA0MDAgMjAwIDYwMCAyNDBDODAwIDI4MCA5MDAgMjIwIDEyMDAgMjUwVjMwMEgweiIvPjwvc3ZnPg=='); animation:wave-flow 25s linear infinite; }
#wave2 { background-image:url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjAwIDMwMCI+PHBhdGggZmlsbD0iIzBjNGE2ZSIgb3BhY2l0eT0iMC41IiBkPSJNMCAyNjBDMjgwIDMxMCA0MjAgMjEwIDYwMCAyNTBDNzgwIDI5MCA5MjAgMjMwIDEyMDAgMjYwVjMwMEgweiIvPjwvc3ZnPg=='); animation:wave-flow 20s linear infinite reverse; }
.theme-ocean .main-gradient-text { background: linear-gradient(to right, #38bdf8, #67e8f9); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* --- New Animated Themes --- */
/* Fireflies Theme */
html.theme-fireflies body { background-color: #011422; }
.theme-fireflies .main-gradient-text { background: linear-gradient(to right, #fef08a, #fde047); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.theme-fireflies .lecture-card:hover { border-color: #fde047; }

/* Dream Theme */
html.theme-dream-garden body { 
    background: linear-gradient(-45deg, #4c0d6b, #a4508b, #e9a8a8, #a4508b, #4c0d6b);
    background-size: 400% 400%;
    animation: garden-dream-flow 15s ease infinite;
}
html.theme-dream-garden .main-gradient-text { background: linear-gradient(to right, #fbcfe8, #fce7f3); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
html.theme-dream-garden .lecture-card:hover { border-color: #fbcfe8; }
.crystal-item { position: absolute; animation: crystal-rotate 30s linear infinite; filter: drop-shadow(0 0 15px white); transition: transform 0.3s; width: 60px; height: 60px; pointer-events: auto; }
.crystal-item:hover { transform: scale(1.2) rotate(15deg) !important; }

/* Focus Theme */
html.theme-focus-study body { background: #282a36; }
.theme-focus-study .main-gradient-text { background: linear-gradient(to right, #a5f3fc, #67e8f9); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.theme-focus-study .lecture-card:hover { border-color: #a5f3fc; }

/* Mobile Improvements */
@media (max-width: 768px) {
    /* تحسين الهيدر للموبايل */
    header {
        transition: transform 0.3s ease-in-out;
    }
    
    header.header-hidden {
        transform: translateY(-100%);
    }
    
    /* تحسين الأزرار للموبايل */
    .control-btn {
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 1.5rem !important;
        margin: 0 0.25rem !important;
    }
    
    /* تحسين المسافات بين الأزرار */
    .flex.items-center.gap-2 {
        gap: 0.5rem !important;
    }
    
    /* تحسين حجم النص في الأزرار */
    .mixer-input {
        width: 3rem !important;
        font-size: 1.1rem !important;
    }
    
    /* تحسين المسافات في grid */
    .grid.grid-cols-2.gap-4 {
        gap: 1rem !important;
    }
    
    /* جعل الأزرار تحت بعضها في الموبايل */
    .grid.grid-cols-2 {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
}

/* --- Mixer Modal Mobile Fix --- */
@media (max-width: 768px) {
  #mixer-modal .mixer-step-title,
  #mixer-modal .mixer-step-number,
  #mixer-modal .mixer-source-card,
  #mixer-modal .mixer-input,
  #mixer-modal .control-btn,
  #mixer-modal #total-questions-info,
  #mixer-modal #time-limit-info,
  #mixer-modal .mixer-error {
    /* لا تغيير هنا */
  }
  #mixer-modal .space-y-6 {
    max-height: 55vh;
    overflow-y: auto;
    margin-bottom: 4.5rem;
  }
  #mixer-modal #mixer-start-btn {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 2.5vh;
    margin: 0 auto;
    width: 90vw;
    max-width: 500px;
    z-index: 100;
    border-radius: 1.5rem;
    box-shadow: 0 4px 24px 0 rgba(59,130,246,0.13);
  }
  #mixer-modal {
    padding-bottom: 6rem !important;
  }
}


