/* ===============================
   DESIGN SYSTEM – JAMIA DARUSSALAM
   (Intrinsic Design & Logical Properties Refactor)
   ============================== */

/* ===============================
   1. VARIABLES & FLUID TYPOGRAPHY
   =============================== */
:root {
  /* COLORS (Royal Theme) */
  --primary: #113649;
  --accent:  #a77c2f;
  --cream:   #f4efe9;
  --bg:      #113649;
  --text:    #f4efe9;

  /* FLUID TYPOGRAPHY */
  --fs-hero:  clamp(2rem, 5vw + 1rem, 3.8rem);
  --fs-h1:    clamp(1.8rem, 4vw + 0.5rem, 2.5rem);
  --fs-h2:    clamp(1.5rem, 3vw + 0.5rem, 2rem);
  --fs-body:  clamp(0.9rem, 1vw + 0.6rem, 1.1rem);
  
  /* SPACING */
  --space-sm: clamp(0.5rem, 1vw, 1rem);
  --space-md: clamp(1.5rem, 3vw, 3rem);
  --space-lg: clamp(3rem, 5vw, 6rem);
}

/* ===============================
   2. GLOBAL RESET & BASE
   =============================== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: var(--fs-body);
  position: relative;
  min-height: 100vh;
}

/* Background Pattern */
body::before {
  content: "";
  position: fixed;
  inset: 0; 
  background-image: url('../images/pattern.webp');
  background-repeat: repeat;
  background-size: 150px;
  opacity: 0.20;
  z-index: 0;
  pointer-events: none;
}

/* Layers */
.top-bar, .site-header { position: relative; z-index: 100; }
main, footer, section, .hero { position: relative; z-index: 1; }

/* Links & Headings */
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4, h5, h6 { margin: 0; color: var(--accent); line-height: 1.2; }

/* Container */
.container {
  width: min(100% - 2rem, 1200px);
  margin-inline: auto;
}

/* ===============================
   3. CUSTOM FONTS
   =============================== */
@font-face { font-family: "E111 Viva"; src: url("../fonts/E111Viva.ttf") format("truetype"); }
@font-face { font-family: "Jameel Noori"; src: url("../fonts/JameelNoori.ttf") format("truetype"); }
@font-face { font-family: "Koufi"; src: url("../fonts/KoufiBold.ttf") format("truetype"); }
@font-face { font-family: "Majalla"; src: url("../fonts/Majalla.ttf") format("truetype"); }

/* Language Logic */
body.ur { font-family: "Jameel Noori", serif; font-size: 1.35rem; line-height: 2.3; }
body.ar { font-family: "Majalla", serif; font-size: 1.6rem; line-height: 1.6; }

/* ===============================
   4. TOP UTILITY BAR (Intrinsic)
   =============================== */
.top-bar {
  background-color: var(--cream);
  color: var(--accent);
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: relative;
  z-index: 102;
}

.top-bar-inner {
  width: min(100% - 2rem, 1200px);
  margin-inline: auto;
  padding-block: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.top-info, .top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.search-btn, .lang-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); display: flex; align-items: center;
}
.search-icon, .contact-icon, .lang-arrow {
  width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none;
}
.contact-link { display: flex; align-items: center; gap: 0.4rem; font-weight: 500; }

.cta-btn {
  background-color: var(--accent);
  color: #fff;
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

/* ===============================
   5. HEADER & BRAND BAR (Intrinsic)
   =============================== */
.site-header { background-color: var(--primary); }

.brand-bar {
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-block: 1rem;
}

.brand-bar::before {
  content: ""; position: absolute; inset: 0;
  background-image: url('../images/pattern.webp');
  background-repeat: repeat; background-size: 150px;
  opacity: 0.20; z-index: -1; pointer-events: none;
}

.brand-inner {
  width: min(100% - 2rem, 1200px);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.brand-center { flex: 0 0 auto; order: 2; }
.brand-side   { flex: 1 1 200px; display: flex; align-items: center; }
.brand-left   { order: 1; justify-content: flex-start; }
.brand-right  { order: 3; justify-content: flex-end; }

.brand-emblem { height: clamp(80px, 12vw, 125px); width: auto; filter: drop-shadow(0 4px 15px rgba(0,0,0,0.3)); }
.brand-text-img { height: clamp(40px, 6vw, 100px); width: auto; opacity: 0.95; }

/* ===============================
   6. NAVIGATION (Hybrid Intrinsic/Toggle)
   =============================== */
.nav-bar-row {
  background-color: var(--cream);
  border-bottom: 1px solid var(--accent);
}

.main-nav { display: flex; justify-content: center; }

.nav-list {
  list-style: none; margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.nav-item {
  position: relative;
}

.nav-item > a {
  display: block;
  padding: 0.85rem 0.3rem; 
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.26px;
  position: relative;
  white-space: nowrap; 
}

.nav-item > a::after {
  content: ""; display: block; height: 3px; width: 0;
  background-color: var(--accent);
  position: absolute; bottom: 0; left: 0.5rem;
  transition: width 0.25s ease;
}
.nav-item:hover > a::after { width: calc(100% - 1rem); }

/* Dropdowns */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%; 
  inset-inline-start: 0; 
  background-color: var(--bg);
  min-width: 220px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
  border-top: 3px solid var(--accent);
  padding: 0.5rem 0;
  list-style: none;
  z-index: 1000;
}
.nav-item:hover .dropdown-menu { display: block; }
.dropdown-menu li a {
  display: block; padding: 0.6rem 1.2rem; color: var(--cream);
  border-inline-start: 3px solid transparent; 
  transition: all 0.2s;
  padding: 0.6rem 1.2rem;
  font-size: 0.85rem;
  white-space: normal;
}
.dropdown-menu li a:hover {
  background-color: rgba(255,255,255,0.05);
  color: var(--accent);
  border-inline-start-color: var(--accent);
}

.mobile-toggle { display: none; }

/* GLOBAL: Hide the mobile arrow by default on all screens */
.dropdown-toggle-btn {
  display: none;
}

/* ===============================
   7. HERO SECTION
   =============================== */
.hero-section {
  position: relative;
  background-color: var(--primary);
  padding-block: var(--space-lg);
  text-align: center;
  color: #fff;
  isolation: isolate;
}

.hero-overlay {
  position: absolute; inset: 0;
  background: rgba(17, 54, 73, 0.85);
  z-index: -1;
}

.hero-subtitle {
  color: var(--accent);
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 1rem;
}

.hero-title {
  font-family: "E111 Viva", serif;
  font-size: var(--fs-hero); 
  color: var(--cream);
  margin-bottom: 1.5rem;
}

.hero-text {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: rgba(255,255,255,0.9);
  max-width: 65ch;
  margin-inline: auto;
  margin-bottom: 2.5rem;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap; 
  gap: 1rem;
  justify-content: center;
}

.btn {
  padding: 0.8rem 2rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9rem;
  transition: all 0.3s;
  display: inline-block;
}
.btn-gold { background-color: var(--accent); color: #fff; }
.btn-gold:hover { background-color: #c49642; }
.btn-outline { border: 2px solid var(--cream); color: var(--cream); }
.btn-outline:hover { background-color: var(--cream); color: var(--primary); }

/* ===============================
   8. GRID LAYOUTS (Auto-Fit)
   =============================== */
.quick-access {
  background-color: var(--cream);
  padding-block: var(--space-lg);
  margin-top: -3rem;
  position: relative; z-index: 3;
}

.grid-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 2rem;
}

.access-card {
  background: #ffffff;
  padding: 2rem;
  border-radius: 8px;
  border-top: 4px solid var(--accent);
  box-shadow: 0 5px 20px rgba(0,0,0,0.05);
  text-align: center;
  transition: transform 0.3s ease;
}
.access-card:hover { transform: translateY(-5px); }
.card-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.access-card h3 { color: var(--primary); margin-bottom: 0.5rem; font-size: 1.2rem; }
.access-card p { color: #666; font-size: 0.9rem; }

/* ===============================
   9. GALLERY SLIDER
   =============================== */
.gallery-section {
  padding-block: 0.5rem;
  background-color: transparent;
}
.gallery-section h2 { display: none; }

.slider-frame {
  width: 100%;
  max-width: 1400px;
  height: clamp(250px, 50vw, 500px);
  margin-inline: auto;
  border-radius: clamp(0px, 2vw, 20px);
  border: 4px solid var(--accent);
  box-shadow: 0 15px 40px rgba(0,0,0,0.2);
  overflow: hidden;
  position: relative;
}

.slider-track { display: flex; height: 100%; transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1); }
.slide-img { width: 100%; flex-shrink: 0; height: 100%; object-fit: cover; }

.slider-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: clamp(35px, 5vw, 50px); height: clamp(35px, 5vw, 50px);
  border-radius: 50%;
  background-color: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 10;
  transition: all 0.3s ease;
}
.slider-btn:hover { background-color: var(--accent); color: #fff; }
.prev-btn { left: 10px; }
.next-btn { right: 10px; }

/* ===============================
   10. CONTENT & SIDEBARS
   =============================== */
main .container {
  background-color: var(--cream);
  color: var(--primary);
  padding: clamp(1.5rem, 5vw, 3rem);
  border-radius: 8px;
  margin-block: 2rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
main p, main li { color: var(--primary); }

/* Intrinsic Sidebar Layout (Desktop Default) */
.sidebar-layout {
  display: flex;
  flex-wrap: wrap; 
  gap: 2rem;
  align-items: flex-start;
}

.sidebar-menu {
  flex: 1 1 250px; 
  position: sticky; top: 20px;
  min-width: 250px;
}
.main-content-area {
  flex: 999 1 300px;
  background-color: #fff;
  padding: clamp(1.5rem, 4vw, 3rem);
  border-radius: 8px;
}

.sidebar-box {
  background: #fff; border-top: 4px solid var(--accent); padding: 1.5rem; border-radius: 4px;
}
.sidebar-list a { display: block; padding: 0.6rem 1rem; color: var(--primary); }
.sidebar-list a:hover { background-color: var(--cream); padding-inline-start: 1.2rem; }

/* ===============================
   WIDE MENU (Desktop)
   =============================== */
@media (min-width: 1025px) {
  .dropdown-menu.wide-menu {
    display: none; min-width: 600px; padding: 0;
    grid-template-columns: 1fr 1fr; gap: 0;
    left: 0; right: auto;
  }
  .nav-item:hover .dropdown-menu.wide-menu { display: grid; }
  .menu-column { padding: 1rem 0; }
  .menu-column:first-child { background-color: rgba(0,0,0,0.1); border-right: 1px solid rgba(255,255,255,0.1); }
  .menu-header { color: var(--accent); font-weight: bold; text-transform: uppercase; font-size: 0.85rem; padding: 0.5rem 1.2rem; margin-bottom: 0.5rem; letter-spacing: 1px; }
}

/* ==========================================================================
   RESPONSIVE ENGINE (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 1024px) {
  
  /* --- 1. TOP BAR & BRANDING --- */
  .top-bar-inner { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 1rem; height: 60px; gap: 0.5rem; }
  .top-info { display: none; } 
  .top-actions { display: flex; align-items: center; gap: 0.8rem; margin-right: auto; }

  /* Mobile Menu Button */
  .mobile-toggle {
    display: flex; flex-direction: column; justify-content: space-between;
    width: 26px; height: 18px; background: none; border: none; padding: 0; cursor: pointer;
    z-index: 2000; order: 2; 
  }
  .mobile-toggle .bar { height: 2px; width: 100%; background: var(--accent); border-radius: 2px; }

  /* Language & CTA */
  .lang-btn span { display: inline-block; font-size: 0; }
  .lang-btn span::before { content: "EN"; font-size: 0.8rem; font-weight: 700; color: var(--accent); }
  .contact-link span { display: none; } 
  .cta-btn { font-size: 0; padding: 0.4rem 0.8rem; }
  .cta-btn::before { content: "Study at Jamia"; font-size: 0.75rem; font-weight: 600; }

  /* Branding */
  .brand-inner {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    padding: 0.8rem 1rem; gap: 0.5rem; min-height: auto;
  }
  .brand-left { order: 1; justify-self: start; } 
  .brand-center { order: 2; justify-self: center; } 
  .brand-right { order: 3; justify-self: end; }   
  .brand-side, .brand-center { width: auto; margin: 0; flex: unset; display: block; }
  .brand-emblem { height: 65px; } 
  .brand-text-img { height: 45px; } 

  /* --- 2. MAIN NAVIGATION (Drawer) --- */
  .main-nav {
    display: block !important; position: fixed; top: 0; right: -100%; left: auto;   
    width: 85%; max-width: 320px; height: 100vh; background-color: var(--primary);
    z-index: 9999; padding-top: 60px; 
    transition: right 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: -5px 0 25px rgba(0,0,0,0.5); overflow-y: auto; 
  }
  .main-nav.active { right: 0; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.6); }
  .main-nav::before {
    content: "MENU"; display: block; position: absolute; top: 20px; left: 20px;
    font-size: 0.9rem; font-weight: bold; color: var(--accent); letter-spacing: 2px;
    border-bottom: 1px solid rgba(255,255,255,0.1); width: 80%; padding-bottom: 10px;
  }

  .nav-list { flex-direction: column; width: 100%; }
  .nav-item { width: 100%; display: flex; flex-wrap: wrap; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.05); position: relative; }
  .nav-item > a { flex: 1; padding: 1rem 3.5rem 1rem 1.5rem; font-size: 0.9rem; color: var(--text); }

  /* Mobile Dropdown Arrow */
  .dropdown-toggle-btn {
    display: flex; position: absolute; top: 0; right: 0; width: 50px; height: 54px;
    align-items: center; justify-content: center;
    border-left: 1px solid rgba(255,255,255,0.05); cursor: pointer; color: var(--accent); 
    transition: transform 0.3s ease; z-index: 10;
  }
  .dropdown-toggle-btn.active { transform: rotate(90deg); background-color: rgba(0,0,0,0.1); }

  .dropdown-menu, .wide-menu {
    flex-basis: 100%; width: 100%; display: none; position: static; 
    background: rgba(0,0,0,0.2); box-shadow: inset 0 5px 10px rgba(0,0,0,0.2); border: none; padding: 0;
  }
  .dropdown-menu.open, .wide-menu.open { display: block; }
  .nav-item:hover .dropdown-menu { display: none; }
  .nav-item:hover .dropdown-menu.open { display: block; }
  .dropdown-menu li a { padding: 0.8rem 1rem 0.8rem 2.5rem; font-size: 0.85rem; color: rgba(255,255,255,0.8); display: block; }
  .menu-column { width: 100%; padding: 0 1rem; }

  /* --- 3. SIDEBAR FIX (MOBILE ONLY) --- */
  /* This converts the Side-by-Side layout to a Vertical Stack */
  .sidebar-layout {
    display: flex;
    flex-direction: column; 
  }

  .sidebar-menu {
    width: 100%;
    position: static;     /* No sticky on mobile */
    margin-bottom: 2rem;  /* Space below the list */
    order: -1;            /* FORCE to Top */
    z-index: 1;
  }

  /* Keep the list visible and styled simply */
  .sidebar-box {
    padding: 1rem;
    background-color: #f9f9f9; /* Light background to separate it */
    border-top: 4px solid var(--accent);
  }
  
  /* Ensure the list is always visible */
  .sidebar-list {
    display: block !important;
    border: none;
  }
  
  /* Style the Title as a normal header */
  .sidebar-title {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: var(--primary);
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.5rem;
    background: none;
    cursor: default;
  }
  
  /* Remove arrow pointers if they exist */
  .sidebar-title::after { display: none; }
}

@media (max-width: 380px) {
  .brand-text-img { height: 28px; } 
  .brand-emblem { height: 55px; }
  .cta-btn { display: none; } 
}

/* ===============================
   LANGUAGE DROPDOWN FIX
   =============================== */
.lang-dropdown { position: relative; display: inline-block; }
.lang-menu {
  display: none; position: absolute; top: 100%; right: 0; inset-inline-end: 0;
  background-color: var(--primary); min-width: 140px; border: 1px solid rgba(255,255,255,0.1); 
  border-top: 3px solid var(--accent); z-index: 5000; box-shadow: 0 10px 20px rgba(0,0,0,0.3); border-radius: 0 0 4px 4px;
}
.lang-dropdown:hover .lang-menu { display: block; }
.lang-menu a { display: block; padding: 0.8rem 1.2rem; color: var(--cream); text-align: right; text-decoration: none; font-size: 0.9rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.lang-menu a:hover { background: rgba(255,255,255,0.05); color: var(--accent); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }


/* ===============================
   NAVBAR WIDTH FIX (THE MISSING PIECE)
   =============================== */
/* Forces the container to ignore the 1200px limit specifically for the menu row */
.nav-bar-row .container {
  width: 98%; 
  max-width: none; 
}

/* =========================================
   COMING SOON / UNDER CONSTRUCTION STYLE
   ========================================= */
.coming-soon-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 400px;
  background-color: #faf7f2; /* Cream background */
  border: 2px dashed #d4a853; /* Gold dashed border */
  border-radius: 12px;
  margin: 2rem 0;
  padding: 2rem;
}

.coming-soon-box h2 {
  color: #065f46; /* Emerald Green */
  font-family: "E111 Viva", serif;
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.coming-soon-box p {
  color: #555;
  font-size: 1.2rem;
  max-width: 600px;
  margin-bottom: 2rem;
}

.coming-soon-btn {
  display: inline-block;
  background-color: #d4a853;
  color: white;
  padding: 12px 24px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: background 0.3s;
}

.coming-soon-btn:hover {
  background-color: #bfa060;
}

/* VIDEO SLIDER STYLES */
.slide-video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* This makes the video fill the box nicely like an image */
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1; /* Ensures text sits ON TOP of the video */
}

