/* ═════════════════════════════════════════════════════════════════════════════
   JAMIA IMAM MEHDI ARABIC COLLEGE — NATIVE MOBILE APP EXPERIENCE SYSTEM
   Note: All mobile styles are strictly scoped under @media (max-width: 768px).
   Desktop view (min-width: 769px) remains 100% UNTOUCHED and PRISTINE.
   ═════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────
   1. DESKTOP VIEW SAFETY SCOPE (min-width: 769px)
   ───────────────────────────────────────────────────────── */
@media (min-width: 769px) {
  #mobileAppDrawer,
  .mobile-app-drawer,
  .mobile-bottom-nav {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* ─────────────────────────────────────────────────────────
   2. MOBILE APP VIEW SCOPE (max-width: 768px)
   ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Global Mobile Body & Smooth Touch Scrolling Setup */
  html {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-text-size-adjust: 100% !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: calc(78px + env(safe-area-inset-bottom)) !important;
  }

  /* Lock Body Scrolling ONLY when drawer is open */
  html.drawer-open,
  body.drawer-open {
    overflow: hidden !important;
    touch-action: none !important;
  }

  /* Universal Media Scaling */
  img, video, iframe, canvas {
    max-width: 100% !important;
    height: auto;
  }

  /* Mobile Input Zoom Prevention (iOS Safari) */
  input, select, textarea, button {
    font-size: 16px !important;
    touch-action: manipulation;
  }

  /* Smooth Touch Feedback on Interactive Elements */
  a, button, .d-card, .arch-card, .btn-h-primary, .btn-h-outline, .btn-apply-gold, .btn-donate-dark {
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.2s ease, box-shadow 0.2s ease;
  }
  a:active, button:active, .d-card:active {
    transform: scale(0.97) !important;
  }

  /* ─────────────────────────────────────────────────────────
     3. TOP BAR CONTACT & LOCATION (FIX CROPPING ON MOBILE)
     ───────────────────────────────────────────────────────── */
  .top-bar {
    padding: 6px 12px !important;
    height: auto !important;
    min-height: 32px !important;
    background: #041c16 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    border-bottom: 1px solid rgba(232, 201, 106, 0.18) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
  }

  .top-bar-inner {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px 14px !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    white-space: normal !important;
  }

  .top-bar-left {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px 12px !important;
    width: 100% !important;
    text-align: center !important;
    white-space: normal !important;
    overflow: visible !important;
  }

  .top-info-item {
    font-size: 0.73rem !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    color: rgba(255, 255, 255, 0.92) !important;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .top-info-item svg, .top-info-item i {
    flex-shrink: 0 !important;
    color: #e8c96a !important;
  }

  .top-bar-right {
    display: none !important;
  }

  /* ─────────────────────────────────────────────────────────
     4. STICKY TOP APP HEADER & BRAND LOGO TEXT VISIBILITY
     ───────────────────────────────────────────────────────── */
  .navbar, header.portal-nav-bar {
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    background: rgba(6, 49, 38, 0.96) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18) !important;
    border-bottom: 1px solid rgba(232, 201, 106, 0.15) !important;
  }

  .nav-inner {
    padding: 0 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 62px !important;
    height: 62px !important;
  }

  .logo-img-wrap {
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
  }

  .logo-img-wrap img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  /* College Name Text High-Contrast Visibility Fix on Dark Mobile Navbar */
  .logo-txt {
    display: flex !important;
    flex-direction: column !important;
    line-height: 1.1 !important;
  }

  .logo-txt .lt {
    color: #e8c96a !important; /* Premium Gold */
    font-size: 0.58rem !important;
    font-weight: 800 !important;
    letter-spacing: 2px !important;
    text-transform: uppercase !important;
  }

  .logo-txt .lm {
    color: #ffffff !important; /* Pure Crisp White */
    font-family: 'Playfair Display', Georgia, serif !important;
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    line-height: 1.05 !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6) !important;
  }

  .logo-txt .lb {
    color: #e8c96a !important; /* Premium Gold */
    font-size: 0.56rem !important;
    font-weight: 800 !important;
    letter-spacing: 1.5px !important;
    text-transform: uppercase !important;
  }

  /* Hide default inline list & desktop admission button on mobile in favor of App Drawer */
  ul.nav-links,
  .nav-links,
  .btn-nav-adm {
    display: none !important;
  }

  .nav-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
  }

  .btn-nav-user {
    display: flex !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    background: rgba(232, 201, 106, 0.12) !important;
    border: 1px solid rgba(232, 201, 106, 0.3) !important;
    color: #e8c96a !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.9rem !important;
    text-decoration: none !important;
  }

  /* Hamburger Menu Button Styling & Active Morphing */
  .hamburger {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
    background: rgba(232, 201, 106, 0.15) !important;
    border: 1px solid rgba(232, 201, 106, 0.35) !important;
    cursor: pointer !important;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .hamburger span {
    display: block !important;
    width: 20px !important;
    height: 2.5px !important;
    background: #e8c96a !important;
    border-radius: 4px !important;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    transform-origin: center !important;
  }

  .hamburger:active {
    background: rgba(232, 201, 106, 0.3) !important;
    transform: scale(0.92) !important;
  }

  /* Hamburger morphing active state when drawer is open */
  body.drawer-open .hamburger {
    background: rgba(232, 201, 106, 0.28) !important;
    border-color: rgba(232, 201, 106, 0.6) !important;
    transform: rotate(90deg) !important;
  }

  body.drawer-open .hamburger span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg) !important;
  }

  body.drawer-open .hamburger span:nth-child(2) {
    opacity: 0 !important;
    transform: scaleX(0) !important;
  }

  body.drawer-open .hamburger span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg) !important;
  }

  /* ─────────────────────────────────────────────────────────
     5. NATIVE MOBILE APP DRAWER PANEL (SIDE-SHEET)
     ───────────────────────────────────────────────────────── */
  .mobile-app-drawer {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99999 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: visibility 0.4s ease !important;
  }

  .mobile-app-drawer.open {
    visibility: visible !important;
    pointer-events: auto !important;
  }

  /* Backdrop Overlay */
  .drawer-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(3, 20, 15, 0.78) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .mobile-app-drawer.open .drawer-backdrop {
    opacity: 1 !important;
  }

  /* Drawer Panel */
  .drawer-panel {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 86% !important;
    max-width: 360px !important;
    height: 100% !important;
    max-height: 100vh !important;
    background: linear-gradient(175deg, #063126 0%, #031b15 100%) !important;
    color: #ffffff !important;
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.55), -2px 0 10px rgba(232, 201, 106, 0.2) !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translate3d(100%, 0, 0) !important;
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-left: 1px solid rgba(232, 201, 106, 0.3) !important;
    z-index: 100000 !important;
    will-change: transform;
  }

  .mobile-app-drawer.open .drawer-panel {
    transform: translate3d(0, 0, 0) !important;
  }

  /* Keyframes for Staggered Cascade Entry */
  @keyframes drawerCascadeSlide {
    0% {
      opacity: 0;
      transform: translate3d(28px, 0, 0);
    }
    100% {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
  }

  /* Staggered Animations when Drawer is Open */
  .mobile-app-drawer.open .drawer-header {
    animation: drawerCascadeSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both !important;
  }

  .mobile-app-drawer.open .drawer-quick-card {
    animation: drawerCascadeSlide 0.42s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both !important;
  }

  .mobile-app-drawer.open .drawer-menu-label {
    animation: drawerCascadeSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.16s both !important;
  }

  .mobile-app-drawer.open .drawer-item:nth-child(1) { animation: drawerCascadeSlide 0.38s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both !important; }
  .mobile-app-drawer.open .drawer-item:nth-child(2) { animation: drawerCascadeSlide 0.38s cubic-bezier(0.16, 1, 0.3, 1) 0.21s both !important; }
  .mobile-app-drawer.open .drawer-item:nth-child(3) { animation: drawerCascadeSlide 0.38s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both !important; }
  .mobile-app-drawer.open .drawer-item:nth-child(4) { animation: drawerCascadeSlide 0.38s cubic-bezier(0.16, 1, 0.3, 1) 0.27s both !important; }
  .mobile-app-drawer.open .drawer-item:nth-child(5) { animation: drawerCascadeSlide 0.38s cubic-bezier(0.16, 1, 0.3, 1) 0.30s both !important; }
  .mobile-app-drawer.open .drawer-item:nth-child(6) { animation: drawerCascadeSlide 0.38s cubic-bezier(0.16, 1, 0.3, 1) 0.33s both !important; }
  .mobile-app-drawer.open .drawer-item:nth-child(7) { animation: drawerCascadeSlide 0.38s cubic-bezier(0.16, 1, 0.3, 1) 0.36s both !important; }

  .mobile-app-drawer.open .drawer-footer {
    animation: drawerCascadeSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.38s both !important;
  }

  /* Drawer Header */
  .drawer-header {
    padding: 20px 18px 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(0, 0, 0, 0.15) !important;
    flex-shrink: 0 !important;
  }

  .drawer-brand {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
  }

  .drawer-logo {
    width: 42px !important;
    height: 42px !important;
    object-fit: contain !important;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3)) !important;
  }

  .drawer-title-wrap {
    display: flex !important;
    flex-direction: column !important;
  }

  .drawer-title {
    font-family: 'Playfair Display', serif !important;
    font-weight: 700 !important;
    font-size: 1.05rem !important;
    color: #e8c96a !important;
    letter-spacing: 0.5px !important;
    line-height: 1.2 !important;
  }

  .drawer-subtitle {
    font-size: 0.72rem !important;
    color: rgba(255, 255, 255, 0.7) !important;
    margin-top: 2px !important;
  }

  .drawer-close-btn {
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.1rem !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
  }

  .drawer-close-btn:active {
    transform: rotate(90deg) scale(0.9) !important;
    background: rgba(232, 201, 106, 0.3) !important;
    color: #e8c96a !important;
  }

  /* Highlighted Quick Donation Card inside Drawer */
  .drawer-quick-card {
    margin: 16px !important;
    padding: 16px !important;
    background: linear-gradient(135deg, rgba(232, 201, 106, 0.22) 0%, rgba(10, 53, 40, 0.95) 50%, rgba(232, 201, 106, 0.12) 100%) !important;
    border: 1px solid rgba(232, 201, 106, 0.5) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    flex-shrink: 0 !important;
    position: relative !important;
    overflow: hidden !important;
  }

  .drawer-quick-card::before {
    content: '' !important;
    position: absolute !important;
    top: -50% !important;
    right: -50% !important;
    width: 140px !important;
    height: 140px !important;
    background: radial-gradient(circle, rgba(232, 201, 106, 0.2) 0%, transparent 70%) !important;
    pointer-events: none !important;
  }

  .dqc-badge {
    display: inline-flex !important;
    align-items: center !important;
    font-size: 0.70rem !important;
    font-weight: 800 !important;
    color: #e8c96a !important;
    letter-spacing: 0.8px !important;
    text-transform: uppercase !important;
    margin-bottom: 6px !important;
    background: rgba(232, 201, 106, 0.12) !important;
    padding: 3px 10px !important;
    border-radius: 20px !important;
    border: 1px solid rgba(232, 201, 106, 0.3) !important;
  }

  .dqc-title {
    font-family: 'Playfair Display', Georgia, serif !important;
    font-size: 0.96rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    margin-bottom: 4px !important;
    line-height: 1.25 !important;
  }

  .dqc-text {
    font-size: 0.76rem !important;
    color: rgba(255, 255, 255, 0.86) !important;
    line-height: 1.35 !important;
    margin-bottom: 12px !important;
  }

  .dqc-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    background: linear-gradient(135deg, #e8c96a 0%, #c9a84c 100%) !important;
    color: #063126 !important;
    font-weight: 800 !important;
    font-size: 0.84rem !important;
    padding: 9px 16px !important;
    border-radius: 12px !important;
    text-decoration: none !important;
    box-shadow: 0 4px 14px rgba(201, 168, 76, 0.35) !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .dqc-btn:active {
    transform: scale(0.98) !important;
    box-shadow: 0 2px 8px rgba(201, 168, 76, 0.25) !important;
  }

  /* Drawer Menu Section */
  .drawer-menu-label {
    padding: 12px 18px 6px !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    letter-spacing: 1px !important;
    color: rgba(232, 201, 106, 0.75) !important;
    flex-shrink: 0 !important;
  }

  .drawer-nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    padding: 0 12px !important;
    flex-grow: 1 !important;
  }

  .drawer-item {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 12px 14px !important;
    border-radius: 12px !important;
    color: rgba(255, 255, 255, 0.92) !important;
    text-decoration: none !important;
    font-size: 0.92rem !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
  }

  .drawer-item:hover,
  .drawer-item.active {
    background: rgba(232, 201, 106, 0.15) !important;
    color: #e8c96a !important;
    font-weight: 600 !important;
  }

  .drawer-item.highlight-item {
    background: rgba(232, 201, 106, 0.2) !important;
    border: 1px dashed rgba(232, 201, 106, 0.45) !important;
    color: #e8c96a !important;
  }

  .drawer-item.admin-item {
    margin-top: 6px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 0 !important;
    padding-top: 14px !important;
  }

  .di-icon {
    width: 32px !important;
    height: 32px !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.95rem !important;
    color: #e8c96a !important;
    flex-shrink: 0 !important;
  }

  .drawer-item.active .di-icon {
    background: #e8c96a !important;
    color: #063126 !important;
  }

  .di-arrow {
    margin-left: auto !important;
    font-size: 0.75rem !important;
    opacity: 0.4 !important;
  }

  /* Drawer Footer */
  .drawer-footer {
    margin-top: auto !important;
    padding: 16px 18px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(0, 0, 0, 0.25) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    flex-shrink: 0 !important;
  }

  .df-contact {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    font-size: 0.78rem !important;
    color: rgba(255, 255, 255, 0.85) !important;
  }

  .df-contact i {
    color: #e8c96a !important;
    font-size: 1.1rem !important;
  }

  .df-social {
    display: flex !important;
    gap: 10px !important;
  }

  .df-social a {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.85rem !important;
    text-decoration: none !important;
  }

  /* ─────────────────────────────────────────────────────────
     6. FIXED BOTTOM TAB BAR
     ───────────────────────────────────────────────────────── */
  .mobile-bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    height: calc(66px + env(safe-area-inset-bottom)) !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    background: rgba(6, 49, 38, 0.96) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-top: 1px solid rgba(232, 201, 106, 0.25) !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25) !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
  }

  .mb-nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 !important;
    height: 100% !important;
    color: rgba(255, 255, 255, 0.65) !important;
    text-decoration: none !important;
    background: none !important;
    border: none !important;
    padding: 6px 0 !important;
    cursor: pointer !important;
    position: relative !important;
    transition: all 0.22s ease !important;
  }

  .mb-nav-item i {
    font-size: 1.2rem !important;
    margin-bottom: 3px !important;
    transition: transform 0.2s ease, color 0.2s ease !important;
  }

  .mb-nav-item span {
    font-size: 0.68rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.2px !important;
  }

  .mb-nav-item.active,
  .mb-nav-item:active {
    color: #e8c96a !important;
  }

  .mb-nav-item.active i {
    transform: translateY(-2px) scale(1.1) !important;
    color: #e8c96a !important;
  }

  .mb-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    width: 24px;
    height: 3px;
    background: #e8c96a;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px rgba(232, 201, 106, 0.6);
  }

  /* ─────────────────────────────────────────────────────────
     7. MOBILE PAGE CONTENT OPTIMIZATIONS
     ───────────────────────────────────────────────────────── */
  .dash-wrap, .form-page, main, section {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .d-card, .form-card, .prayer-card {
    border-radius: 18px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
  }

  .hero-title {
    font-size: 2.1rem !important;
    line-height: 1.15 !important;
  }

  .hero-desc {
    font-size: 0.92rem !important;
  }
}
