/* =========================================
   Prime Teach Studio - Restyled & Merged
   ========================================= */

/* 🔹 CSS Variables (Dark Theme + Gold/Purple) */
:root {
  --bg-dark: #0a0a0f;
  --bg-card: #151520;
  --primary: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.5);
  --gold: #fbbf24;
  --gold-glow: rgba(251, 191, 36, 0.4);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #2a2a40;
  --radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 🔹 Reset & Base */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', 'Tajawal', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.6;
  min-height: 100vh;
}

/* 🔹 Stars Background */
#stars-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: -2;
  background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #0f0a1a 100%);
  animation: gradientShift 15s ease infinite;
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.star {
  position: absolute; background: #fff; border-radius: 50%;
  animation: twinkle var(--duration, 3s) ease-in-out infinite var(--delay, 0s);
  opacity: var(--opacity, 0.8);
}
@keyframes twinkle {
  0%, 100% { opacity: var(--opacity, 0.8); transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* 🔹 Loader */
#loader {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-dark);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 9999; transition: opacity 0.5s, visibility 0.5s;
}
#loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-logo {
  width: 120px; height: 120px; margin-bottom: 20px;
  animation: pulse 2s infinite; filter: drop-shadow(0 0 25px var(--gold-glow));
}
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.loader-text { font-size: 1.2rem; color: var(--gold); font-weight: 600; letter-spacing: 2px; }
.loader-bar { width: 200px; height: 4px; background: var(--border); border-radius: 2px; margin-top: 15px; overflow: hidden; }
.loader-progress { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--gold)); border-radius: 2px; animation: loading 2s ease-in-out forwards; }
@keyframes loading { to { width: 100%; } }

/* 🔹 Header & Navigation */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(21, 21, 32, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}
.header-content {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1200px; margin: 0 auto; padding: 0 1.5rem;
}
.logo {
  font-size: 1.5rem; font-weight: 800; color: var(--text); text-decoration: none;
}
.logo span { color: var(--gold); }

.nav-links {
  display: flex; gap: 1.5rem; list-style: none; align-items: center;
}
.nav-links a {
  color: var(--text); text-decoration: none; font-weight: 500;
  padding: 8px 12px; border-radius: 8px; transition: var(--transition);
}
.nav-links a:hover { color: var(--gold); background: rgba(251, 191, 36, 0.1); }

.nav-toggle {
  display: none; background: none; border: none; color: var(--text);
  font-size: 1.5rem; cursor: pointer;
}
.theme-toggle {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 0.5rem; border-radius: 50%; cursor: pointer; font-size: 1.2rem;
  color: var(--text); transition: var(--transition);
}
.theme-toggle:hover { transform: rotate(20deg); border-color: var(--primary); }

/* 🔹 Hero */
.hero {
  padding: 4rem 1.5rem; text-align: center; position: relative;
  background: radial-gradient(ellipse at bottom, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
}
.hero h1 {
  font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 800; margin-bottom: 1rem; line-height: 1.3;
}
.gradient {
  background: linear-gradient(90deg, var(--gold), var(--primary), var(--gold));
  background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: shine 3s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }

.hero p {
  font-size: 1.1rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 2rem;
}

/* 🔹 Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; border-radius: 50px; font-weight: 600;
  text-decoration: none; cursor: pointer; border: none;
  transition: var(--transition); font-size: 1rem;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; box-shadow: 0 10px 30px var(--primary-glow);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 15px 40px var(--primary-glow); }

.btn-download { background: var(--primary); color: #fff; flex: 1; justify-content: center; }
.btn-download:hover { background: var(--primary-dark, #6d28d9); }

.btn-outline {
  background: transparent; border: 2px solid var(--primary);
  color: var(--primary); flex: 1; justify-content: center;
}
.btn-outline:hover { background: var(--primary); color: #fff; }

/* 🔹 Apps Grid & Cards */
.apps-section { padding: 3rem 1.5rem; max-width: 1200px; margin: 0 auto; }
.section-title {
  display: block; text-align: center; width: 100%;
  font-size: 1.8rem; margin: 40px auto 30px; font-weight: 700;
  color: var(--gold); position: relative; padding: 0 15px;
}
.section-title::after {
  content: ''; position: absolute; bottom: -10px; left: 50%;
  transform: translateX(-50%); width: 70px; height: 3px;
  background: var(--primary); border-radius: 2px;
}

.apps-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem; padding: 10px;
}
.app-card {
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; text-align: center;
  transition: var(--transition); cursor: default;
  display: flex; flex-direction: column; gap: 1rem;
}
.app-card:hover {
  transform: translateY(-5px); border-color: var(--primary);
  box-shadow: 0 20px 40px var(--primary-glow);
}

.app-icon { min-height: 80px; display: flex; align-items: center; justify-content: center; margin-bottom: 0.5rem; }
.app-icon img {
  max-width: 80px; max-height: 80px; width: auto; height: auto;
  object-fit: contain; border-radius: 12px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
  transition: transform 0.3s ease;
}
.app-card:hover .app-icon img { transform: scale(1.05) rotate(2deg); }

.app-card h3 { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.app-desc { color: var(--text-muted); font-size: 0.95rem; }
.app-features { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.9rem; color: var(--text-muted); }
.app-actions { display: flex; gap: 0.75rem; margin-top: auto; }

/* 🔹 About & Contact */
.about-section, .contact-section {
  padding: 3rem 1.5rem; max-width: 1200px; margin: 0 auto;
  background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(251,191,36,0.05));
  border-radius: var(--radius); margin-top: 2rem;
}
.about-content, .contact-section > p { text-align: center; max-width: 700px; margin: 0 auto; }
.services-list { list-style: none; display: grid; gap: 0.75rem; margin: 1.5rem 0; text-align: right; }
.contact-links { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
.contact-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 0.75rem 1.5rem; border-radius: 50px; color: var(--text);
  text-decoration: none; font-weight: 500; transition: var(--transition);
}
.contact-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(251, 191, 36, 0.1); }

/* 🔹 Footer */
.footer {
  background: var(--bg-card); border-top: 1px solid var(--border);
  padding: 40px 1.5rem 20px; margin-top: 60px;
}
.footer-content {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px; max-width: 1200px; margin: 0 auto; text-align: center;
}
.footer-brand p, .footer-note { color: var(--text-muted); font-size: 0.9rem; }
.footer-links h4, .footer-social h4 { color: var(--gold); margin-bottom: 15px; font-size: 1.1rem; }
.footer-links ul { list-style: none; }
.footer-links li { margin: 8px 0; }
.footer-links a { color: var(--text-muted); text-decoration: none; transition: var(--transition); }
.footer-links a:hover { color: var(--primary); }
.footer-social { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; }
.footer-social a {
  width: 40px; height: 40px; border-radius: 50%; background: var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text); text-decoration: none; transition: var(--transition);
}
.footer-social a:hover { background: var(--primary); transform: translateY(-3px); }
.footer-bottom {
  text-align: center; padding-top: 20px; margin-top: 30px;
  border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.9rem;
}
.footer-bottom a { color: var(--gold); text-decoration: none; }

/* 🔹 Back to Top */
#back-to-top {
  position: fixed; bottom: 30px; left: 30px; width: 50px; height: 50px;
  border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--gold));
  color: #fff; border: none; font-size: 1.3rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: var(--transition);
  box-shadow: 0 5px 20px rgba(0,0,0,0.3); z-index: 999;
}
#back-to-top.visible { opacity: 1; visibility: visible; }
#back-to-top:hover { transform: translateY(-5px); box-shadow: 0 10px 30px var(--primary-glow); }

/* 🔹 Modal */
.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(10, 10, 15, 0.95);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; visibility: hidden; transition: var(--transition); padding: 20px;
}
.modal.active { opacity: 1; visibility: visible; }
.modal-content {
  background: var(--bg-card); border: 2px solid var(--primary); border-radius: 20px;
  max-width: 550px; width: 100%; padding: 0; text-align: center; position: relative;
  transform: scale(0.9); transition: transform 0.3s;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5); max-height: 90vh; overflow-y: auto;
}
.modal.active .modal-content { transform: scale(1); }
.modal-close {
  position: absolute; top: 15px; left: 15px; width: 35px; height: 35px;
  border-radius: 50%; background: var(--border); border: none; color: var(--text);
  font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition); z-index: 10;
}
.modal-close:hover { background: var(--primary); transform: rotate(90deg); }
.modal-body { padding: 20px 25px 30px; }
.modal-bio {
  background: rgba(139, 92, 246, 0.1); border-right: 3px solid var(--primary);
  padding: 15px; border-radius: 0 10px 10px 0; margin: 20px 0;
  text-align: right; font-size: 0.95rem; line-height: 1.7;
}

/* 🔹 Responsive */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-card); flex-direction: column;
    padding: 1.5rem; gap: 1rem; border-bottom: 1px solid var(--border);
    display: none; transform: translateY(-20px); opacity: 0;
    transition: var(--transition);
  }
  .nav-links.active { display: flex; transform: translateY(0); opacity: 1; }
  .app-actions { flex-direction: column; }
  .footer-content { grid-template-columns: 1fr; }
}

/* 🔹 Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }
.modal-content::-webkit-scrollbar-thumb { background: var(--gold); }

/* 🔹 Accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* 🔹 Print */
@media print {
  #loader, #stars-bg, .header, #back-to-top { display: none !important; }
  body { background: #fff; color: #000; }
}