/* ==========================================================================
   Banki Plus (بنكي بلس) - Refactored Non-Overlapping Responsive Architecture
   ==========================================================================
   Breakpoint Tiers:
   1. Base & Desktop (>1365px): Handled by style.css base rules
   2. Large Tablets (1024px → 1365px): iPad Pro, Surface Pro 7/8/9, Galaxy Tab Ultra
   3. Standard Tablets (768px → 1023px): iPad Air, iPad 10th gen, Galaxy Tab
   4. Mobile Smartphones (0px → 767px): iPhone, Android phones (with sub-480px helper)
   ========================================================================== */

/* --------------------------------------------------------------------------
   BASE COMPONENT STYLES: Mobile Navigation Drawer (Unconditional)
   -------------------------------------------------------------------------- */

/* Mobile Navigation Drawer Backdrop Overlay */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, visibility;
}

.mobile-menu-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/* RTL Mobile Menu Slide Panel Drawer */
.mobile-menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(340px, 85vw);
  height: 100vh;
  height: 100dvh;
  background: var(--bg-surface);
  z-index: 1999;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mobile-menu-drawer.is-active {
  transform: translateX(0);
}

/* Drawer Header */
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.drawer-brand {
  display: flex;
  flex-direction: column;
}

.drawer-brand .brand-name-ar {
  font-size: 1.35rem;
  line-height: 1.1;
}

.drawer-brand .brand-tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.drawer-close-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-alt);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.drawer-close-btn:hover {
  background: var(--primary-dark);
  color: var(--text-white);
  transform: rotate(90deg);
}

/* Drawer Body & Nav Links */
.drawer-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
  padding: 1.5rem;
}

.drawer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.drawer-nav-link {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
  border-right: 3px solid transparent;
}

.drawer-nav-link i {
  font-size: 1.1rem;
  color: var(--primary-light);
  width: 24px;
  text-align: center;
  transition: color 0.2s ease;
}

.drawer-nav-link:hover,
.drawer-nav-link.active {
  background: rgba(28, 62, 141, 0.07);
  color: var(--primary-dark);
  border-right-color: var(--primary-dark);
  padding-right: 1.2rem;
}

.drawer-nav-link:hover i,
.drawer-nav-link.active i {
  color: var(--primary-dark);
}

/* Drawer Footer & Mobile Admin Button */
.drawer-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.mobile-admin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.85rem 1.25rem;
  min-height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
  color: var(--text-white);
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(28, 62, 141, 0.25);
  transition: all 0.3s ease;
}

.mobile-admin-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(28, 62, 141, 0.35);
  color: var(--text-white);
}

/* Prevent body scroll when drawer is open */
body.drawer-open {
  overflow: hidden !important;
  touch-action: none;
}


/* ==========================================================================
   TIER 1: LARGE TABLETS & HYBRID TOUCH DEVICES (1024px → 1365px)
   Target: iPad Pro 11" & 12.9" (Safari WebKit Optimized), Surface Pro
   ========================================================================== */
@media (min-width: 1024px) and (max-width: 1365px) {
  /* Header & Navigation WebKit Safe-Area Fixes */
  .header-container {
    padding-left: max(1.75rem, env(safe-area-inset-left));
    padding-right: max(1.75rem, env(safe-area-inset-right));
    gap: 1.25rem;
    min-width: 0;
  }

  .header-brand {
    flex-shrink: 0;
  }

  .main-nav {
    display: flex;
    gap: 1.15rem;
    min-width: 0;
    flex-shrink: 1;
  }

  .nav-link {
    font-size: 0.94rem;
    white-space: nowrap;
  }

  .header-actions-group {
    flex-shrink: 0;
  }

  .hamburger-menu-btn {
    display: none;
  }

  /* Hero Slider WebKit Safari Viewport & Hardware Acceleration Fixes */
  .hero-slider-section {
    padding: 1.25rem 0 2.5rem 0;
  }

  .hero-slider-container {
    height: 520px;
    height: clamp(480px, 55vh, 620px);
    min-height: 480px;
    max-height: 620px;
    border-radius: 20px;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  .hero-slide-bg {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
  }

  .hero-slide-content {
    max-width: min(680px, 85%);
    padding: 3rem 2.5rem;
    margin-right: 2rem;
    text-align: right;
    min-width: 0;
  }

  .hero-slide-title {
    font-size: clamp(1.85rem, 3.2vw, 2.6rem);
    line-height: 1.28;
    margin-bottom: 1rem;
  }

  .hero-slide-desc {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1.85rem;
    max-width: 600px;
    -webkit-line-clamp: 3;
  }

  .hero-actions-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .btn-hero-primary,
  .btn-hero-secondary {
    min-height: 48px;
    padding: 0.8rem 1.6rem;
  }

  /* Grid Layouts - iPad Pro WebKit Cell Clipping Fixes */
  .news-cards-grid > *,
  .about-grid > *,
  .reports-grid > *,
  .footer-grid > * {
    min-width: 0;
  }

  .news-cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }

  .about-grid {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2.5rem;
  }

  .about-features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .reports-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .footer-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 2.25rem 1.5rem;
  }
}

/* iPad Pro Portrait Specific Refinement (1024px → 1149px) */
@media (min-width: 1024px) and (max-width: 1149px) {
  .news-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem 2rem;
  }
}



/* ==========================================================================
   TIER 2: STANDARD TABLETS (768px → 1023px)
   Target: iPad Air, iPad 10th Gen, Galaxy Tab S8/S9
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Header & Drawer Switch */
  .header-container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    gap: 1rem;
  }

  .main-nav {
    display: none;
  }

  .nav-admin-btn {
    display: none;
  }

  .hamburger-menu-btn {
    display: flex;
  }

  /* Hero Slider */
  .hero-slider-section {
    padding: 1.25rem 0 2.25rem 0;
  }

  .hero-slider-container {
    height: 52vh;
    min-height: 480px;
    max-height: 580px;
    border-radius: 18px;
  }

  .hero-slide-content {
    max-width: min(640px, 88%);
    padding: 2.5rem 2rem 4.5rem 2rem;
    margin-right: 1.5rem;
    text-align: right;
  }

  .hero-slide-title {
    font-size: clamp(1.65rem, 3vw, 2.25rem);
    line-height: 1.3;
    margin-bottom: 0.85rem;
  }

  .hero-slide-desc {
    font-size: 0.95rem;
    line-height: 1.68;
    margin-bottom: 1.75rem;
    max-width: 560px;
    -webkit-line-clamp: 3;
  }

  .hero-actions-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
  }

  .slider-arrow {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  /* Grid Layouts */
  .news-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .about-stats-floating {
    position: relative;
    bottom: 0;
    right: 0;
    margin-top: 1.5rem;
    justify-content: space-around;
  }

  .about-features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .reports-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem 2rem;
  }
}


/* ==========================================================================
   TIER 3: MOBILE SMARTPHONES (0px → 767px)
   Target: iPhone, Samsung Galaxy, Google Pixel, Android Smartphones
   ========================================================================== */
@media (max-width: 767px) {
  /* Header & Navigation Drawer Switch */
  .header-container {
    height: 76px;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .main-nav {
    display: none;
  }

  .nav-admin-btn {
    display: none;
  }

  .hamburger-menu-btn {
    display: flex;
  }

  /* Hero Slider Mobile Centering */
  .hero-slider-section {
    padding: 1rem 0 2rem 0;
  }

  .hero-slider-container {
    height: auto;
    min-height: 480px;
    max-height: none;
    border-radius: 16px;
  }

  .hero-slide {
    justify-content: center;
  }

  .hero-slide-bg-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .hero-slide-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    filter: brightness(0.75) contrast(1.05);
  }

  .hero-slide-overlay {
    background:
      linear-gradient(180deg,
        rgba(6, 11, 30, 0.5) 0%,
        rgba(6, 11, 30, 0.85) 55%,
        rgba(6, 11, 30, 0.98) 100%),
      radial-gradient(circle at 50% 40%,
        rgba(78, 119, 214, 0.28) 0%,
        transparent 70%);
  }

  .hero-slide-content {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 2.25rem 1.25rem 5.5rem 1.25rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .hero-slide-badge-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
    width: 100%;
  }

  .hero-ad-tag,
  .hero-slide-date {
    font-size: 0.78rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
    max-width: 100%;
  }

  .hero-slide-date {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  .hero-slide-date i {
    color: #60a5fa;
  }

  .hero-slide-title {
    font-size: 1.5rem;
    line-height: 1.32;
    margin-bottom: 0.85rem;
    text-align: center;
  }

  .hero-slide-desc {
    font-size: 0.9rem;
    line-height: 1.65;
    margin-bottom: 1.5rem;
    -webkit-line-clamp: 3;
    text-align: center;
    max-width: 580px;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions-group {
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    gap: 0.75rem;
  }

  .btn-hero-primary,
  .btn-hero-secondary {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }

  .hero-slider-controls {
    left: 50%;
    transform: translateX(-50%);
    bottom: 1.25rem;
    justify-content: center;
    gap: 1rem;
    width: auto;
  }

  .slider-arrow {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  /* Grid System Mobile Overrides */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .section-title {
    font-size: 1.45rem;
  }

  .news-cards-grid {
    grid-template-columns: 1fr;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .about-features-grid {
    grid-template-columns: 1fr;
  }

  .reports-grid {
    grid-template-columns: 1fr;
  }

  .article-main-title {
    font-size: 1.8rem;
  }

  /* Site Footer Mobile Centering */
  .site-footer {
    text-align: center;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    text-align: center;
  }

  .footer-brand-info {
    align-items: center;
    text-align: center;
  }

  .footer-logo-title {
    text-align: center;
  }

  .footer-desc {
    text-align: center;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
  }

  .footer-social-links {
    justify-content: center;
    width: 100%;
  }

  .footer-heading {
    text-align: center;
  }

  .footer-heading::after {
    right: 50%;
    transform: translateX(50%);
  }

  .footer-links-list {
    align-items: center;
    text-align: center;
  }

  .footer-link-item {
    display: flex;
    justify-content: center;
  }

  .footer-link-item a {
    justify-content: center;
  }

  .newsletter-form {
    align-items: center;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  .newsletter-input {
    text-align: center;
  }

  .footer-bottom-bar {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
    align-items: center;
  }
}


/* --------------------------------------------------------------------------
   SUB-TIER 3b: SMALL MOBILE SCREENS (0px → 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .header-container {
    height: 72px;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .brand-logo-img {
    height: 44px;
    max-width: 140px;
  }

  .brand-name-ar {
    font-size: 1.25rem;
  }

  .brand-tagline {
    font-size: 0.65rem;
  }

  .header-search-btn {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .hamburger-menu-btn {
    width: 44px;
    height: 44px;
  }

  .btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.88rem;
  }

  .hero-slider-container {
    min-height: 440px;
  }

  .hero-slide-badge-row {
    gap: 0.45rem;
    margin-bottom: 0.75rem;
    justify-content: center;
  }

  .hero-ad-tag,
  .hero-slide-date {
    font-size: 0.74rem;
    padding: 0.3rem 0.75rem;
    letter-spacing: 0.1px;
  }

  .hero-slide-date i {
    font-size: 0.82rem;
  }

  .hero-slide-content {
    padding: 1.75rem 1rem 5.25rem 1rem;
    text-align: center;
    align-items: center;
  }

  .hero-slide-title {
    font-size: 1.35rem;
    line-height: 1.35;
    margin-bottom: 0.65rem;
    text-align: center;
  }

  .hero-slide-desc {
    font-size: 0.85rem;
    line-height: 1.55;
    margin-bottom: 1.35rem;
    -webkit-line-clamp: 2;
    text-align: center;
  }

  .hero-actions-group {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }

  .btn-hero-primary,
  .btn-hero-secondary {
    width: 100%;
    justify-content: center;
    padding: 0.7rem 1rem;
    font-size: 0.88rem;
  }

  .hero-slider-controls {
    left: 50%;
    transform: translateX(-50%);
    bottom: 0.9rem;
    gap: 0.75rem;
  }

  .slider-arrow {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
  }

  .slider-dot.active {
    width: 28px;
  }

  .article-meta-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

@media (max-width: 360px) {
  .brand-tagline {
    display: none;
  }

  .mobile-menu-drawer {
    width: 88vw;
  }
}