/* ============================================================
   SAUDI EXPAT GUIDE — responsive.css
   All Mobile & Tablet Breakpoints
   © 2026 Saudi Expats Guide
============================================================ */

/* ══════════════════════════════════════════
   BREAKPOINTS USED
   -- Large Desktop : 1280px+
   -- Desktop       : 1024px
   -- Tablet        : 768px
   -- Mobile Large  : 640px
   -- Mobile Small  : 480px
   -- Mobile XS     : 360px
══════════════════════════════════════════ */

/* ── Global Box Sizing ── */
*, *::before, *::after {
  box-sizing: border-box;
}

img, video, iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Large Desktop (1280px+) ── */
@media (min-width: 1280px) {
  .container {
    max-width: 1200px;
  }
}

/* ── Desktop (max 1024px) ── */
@media (max-width: 1024px) {

  .container {
    padding: 0 20px;
  }

  .section {
    padding: 60px 0;
  }

  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .article-card.featured {
    grid-column: span 2;
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .footer-stats {
    gap: 30px;
    flex-wrap: wrap;
  }

  .calc-layout {
    grid-template-columns: 1fr;
  }

  /* ── Article layout collapses to single column ── */
  .article-layout {
    grid-template-columns: 1fr !important;
    gap: 0;
  }

  .article-content { order: 1; }
  .article-sidebar  { order: 2; margin-top: 32px; }

  /* Sidebar becomes a responsive grid of widgets */
  .article-sidebar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
  }

  /* Hide TOC on tablet — not useful without sticky sidebar */
  .toc-box { display: none; }

  .category-articles-inner {
    grid-template-columns: 1fr;
  }

  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-stats {
    max-width: 100%;
    padding: 20px 30px;
  }
}

/* ── Tablet (max 768px) ── */
@media (max-width: 768px) {

  /* Typography Scale Down */
  :root {
    --text-5xl : 38px;
    --text-4xl : 32px;
    --text-3xl : 28px;
    --text-2xl : 24px;
    --text-xl  : 20px;
  }

  .container {
    padding: 0 16px;
  }

  .section {
    padding: 50px 0;
  }

  .section-heading {
    margin-bottom: 36px;
  }

  .section-heading h2 {
    font-size: 24px;
  }

  /* ── Prevent horizontal overflow ── */
  body { overflow-x: hidden; }
  .article-layout,
  .articles-section,
  .category-hero,
  .article-header { overflow-x: hidden; }

  /* ── Hero ── */
  .hero {
    padding: 50px 0 40px;
    text-align: center;
  }

  .hero-heading {
    font-size: 32px;
    text-align: center;
  }

  .hero-subtext {
    font-size: 16px;
    text-align: center;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
  }

  .hero-buttons .btn {
    width: 100%;
    max-width: 320px;
    text-align: center;
  }

  .hero-stats {
    flex-direction: column;
    padding: 24px;
    gap: 20px;
  }

  .hero-stat {
    border-right: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 20px;
    width: 100%;
    text-align: center;
  }

  .hero-stat:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .hero-stat .stat-number {
    font-size: 28px;
  }

  /* ── Search Bar ── */
  .search-bar {
    flex-direction: column;
    border-radius: var(--radius-lg);
    padding: 12px;
    gap: 10px;
  }

  .search-bar i { display: none; }

  .search-bar input {
    width: 100%;
    text-align: center;
  }

  .search-bar button {
    width: 100%;
    border-radius: var(--radius);
  }

  /* ── Articles Grid ── */
  .articles-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .article-card.featured {
    grid-column: span 1;
    flex-direction: column;
    border-left: none;
    border-top: 3px solid var(--gold);
  }

  .article-card { padding: 18px; }

  /* ── Navbar ── */
  .navbar-toggle { display: flex; }
  .navbar-menu   { display: none; }
  .navbar-menu.open { display: flex; }

  /* ── Category Hero ── */
  .category-hero {
    padding: 40px 16px;
    text-align: center;
  }

  .category-hero h1 {
    font-size: clamp(1.5rem, 5vw, 2rem) !important;
    text-align: center;
  }

  .category-hero p {
    font-size: 0.95rem;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  .category-hero .breadcrumb {
    justify-content: center;
    flex-wrap: wrap;
    text-align: center;
  }

  .category-hero .category-icon {
    margin-left: auto;
    margin-right: auto;
  }

  /* ── Category Header (older pages) ── */
  .category-header {
    padding: 36px 0;
    text-align: center;
  }

  .category-header h1 {
    font-size: 26px;
    text-align: center;
  }

  /* ── Article Header ── */
  .article-header {
    padding: 36px 16px 28px;
    text-align: center;
  }

  .article-header-inner {
    text-align: center;
  }

  .article-header h1 {
    font-size: clamp(1.35rem, 5vw, 1.8rem) !important;
    text-align: center;
  }

  .article-subtitle {
    font-size: 0.95rem;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  .article-meta {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    text-align: center;
  }

  .article-category-tag {
    margin-left: auto;
    margin-right: auto;
    display: inline-block;
  }

  /* ── Breadcrumb ── */
  .breadcrumb {
    justify-content: center;
    flex-wrap: wrap;
    text-align: center;
  }

  /* ── Article Content ── */
  .article-content {
    padding: 24px 16px;
  }

  .article-content h2 {
    font-size: 1.2rem !important;
  }

  .article-content h3 {
    font-size: 1.05rem !important;
  }

  .article-content p,
  .article-content ul li,
  .article-content ol li {
    font-size: 0.93rem;
    line-height: 1.75;
  }

  /* ── Article Layout (single column) ── */
  .article-layout {
    grid-template-columns: 1fr !important;
    padding: 0 12px;
    gap: 0;
  }

  .article-content { order: 1; }
  .article-sidebar  { order: 2; margin-top: 28px; }

  .article-sidebar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* ── Comparison Tables ── */
  .comparison-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px 0;
    border-radius: var(--radius);
  }

  .comparison-table {
    min-width: 500px;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  /* Article table fallback */
  .article-content table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* ── Summary Box ── */
  .summary-box {
    padding: 18px 16px;
    margin-bottom: 24px;
  }

  .summary-box h3 { font-size: 1rem; }
  .summary-box li { font-size: 0.88rem; }

  /* ── Alert Boxes ── */
  .alert {
    padding: 13px 15px;
    font-size: 0.88rem;
  }

  /* ── Example Boxes ── */
  .example-box { padding: 16px; }

  .example-row {
    flex-direction: column;
    gap: 2px;
    padding: 8px 0;
  }

  .example-row span:last-child {
    font-weight: var(--weight-semi);
    color: var(--navy);
  }

  /* ── Steps List ── */
  .steps-list { margin: 16px 0 24px; }

  .step-item {
    gap: 12px;
    margin-bottom: 14px;
    align-items: flex-start;
  }

  .step-num {
    width: 32px !important;
    height: 32px !important;
    font-size: 13px !important;
    flex-shrink: 0;
  }

  .step-body h4 { font-size: 0.93rem; }
  .step-body p  { font-size: 0.86rem; }

  /* ── FAQ List ── */
  .faq-list { gap: 10px; }

  .faq-item {
    padding: 16px;
    margin-bottom: 10px;
  }

  .faq-item h4 { font-size: 0.93rem; }
  .faq-item p  { font-size: 0.87rem; }

  /* ── Consultation CTA ── */
  .article-consult-cta {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    padding: 20px 16px;
  }

  .consult-cta-left {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
  }

  .article-consult-cta .btn {
    width: 100%;
    max-width: 280px;
  }

  /* ── Related Articles ── */
  .related-articles h3 { font-size: 1rem; }

  .related-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }

  .related-card {
    padding: 12px 10px;
    font-size: 0.8rem;
    text-align: center;
  }

  .related-card i {
    font-size: 1rem;
    display: block;
    margin: 0 auto 6px;
  }

  /* ── Sidebar Widgets ── */
  .toc-box { display: none; }

  .sidebar-consult-widget,
  .key-facts-widget,
  .official-links-widget,
  .sidebar-disclaimer {
    max-width: 100%;
  }

  /* ── Category CTA Box ── */
  .category-cta-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 28px 20px;
    gap: 20px;
  }

  .category-cta-box .btn {
    width: 100%;
    max-width: 260px;
  }

  .cta-text h3 { font-size: 1.1rem; text-align: center; }
  .cta-text p  { font-size: 0.88rem; text-align: center; }

  /* ── Section Title (index pages) ── */
  .section-title {
    font-size: 1.05rem;
  }

  .articles-section {
    padding: 32px 16px;
  }

  /* ── Calculator ── */
  .calc-header h1 { font-size: 26px; }

  .calc-form {
    padding: 24px 20px;
  }

  .calc-result {
    padding: 0 20px 24px;
  }

  .calc-box-header {
    padding: 20px;
  }

  .calc-result-box .result-amount {
    font-size: 36px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  /* ── Footer ── */
  .footer-top {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .footer-stats {
    gap: 20px;
    justify-content: space-between;
  }

  .footer-stat-item .stat-number {
    font-size: 22px;
  }

  .footer-bottom-inner {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .footer-legal-links {
    justify-content: center;
    gap: 14px;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 28px;
    text-align: center;
  }

  .footer-brand { align-items: center; }
  .footer-links { align-items: center; }

  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .footer-social { justify-content: center; }

  /* ── Newsletter Form ── */
  .footer-newsletter-form {
    flex-direction: column;
  }

  .footer-newsletter-form button {
    width: 100%;
  }

  /* ── Cookie Banner ── */
  .cookie-banner {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    text-align: center;
  }

  .cookie-buttons {
    flex-direction: row;
    justify-content: center;
    gap: 10px;
  }

  /* ── WhatsApp / Back to Top ── */
  .whatsapp-float {
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
  }

  .back-to-top {
    bottom: 80px;
    right: 20px;
  }

  /* ── Tools Grid ── */
  .tools-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── Result Actions ── */
  .result-actions {
    flex-direction: column;
  }

  /* ── Contact Page ── */
  .contact-layout {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }

  .contact-form { padding: 24px 16px; }
  .contact-info { padding: 0; }

  /* ── About Page ── */
  .about-layout {
    grid-template-columns: 1fr !important;
    gap: 24px;
    text-align: center;
  }

  .about-image {
    max-width: 200px;
    margin: 0 auto;
  }

  .expertise-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  /* ── Homepage Feature Cards ── */
  .features-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .feature-card {
    padding: 20px 16px;
    text-align: center;
  }

  /* ── Homepage Category Cards ── */
  .categories-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .category-card { padding: 20px 16px; }
  .category-card h3 { font-size: 1rem; }

  /* ── Homepage Testimonials ── */
  .testimonials-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .testimonial-card { padding: 18px 16px; }

  /* ── Stats Bar ── */
  .stats-bar {
    flex-direction: column;
    gap: 20px;
    text-align: center;
    padding: 28px 16px;
  }

  .stat-item { text-align: center; }

  /* ── Legal Pages ── */
  .legal-content {
    padding: 24px 16px;
    font-size: 0.9rem;
  }

  /* ── Utility ── */
  .hide-mobile { display: none !important; }
  .text-center-mobile { text-align: center !important; }
  .full-width-mobile  { width: 100% !important; }
}

/* ── Mobile Large (max 640px) ── */
@media (max-width: 640px) {

  :root {
    --text-5xl : 32px;
    --text-4xl : 28px;
    --text-3xl : 24px;
    --text-2xl : 20px;
  }

  .btn {
    padding: 11px 22px;
    font-size: 13px;
  }

  .hero-badge {
    font-size: 11px;
    padding: 5px 12px;
  }

  .hero-heading { font-size: 28px; }

  .section-heading h2 { font-size: 22px; }

  .article-card .card-body {
    padding: 12px 16px 16px;
  }

  .article-card .card-title { font-size: 16px; }

  .popular-searches { justify-content: flex-start; }

  .article-sidebar,
  .calc-sidebar {
    gap: 16px;
  }

  .sidebar-widget,
  .how-it-works,
  .calc-notes,
  .other-calcs,
  .consult-widget {
    padding: 18px;
  }

  .footer-social { flex-wrap: wrap; }

  .footer-stats {
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
  }

  .alert {
    padding: 12px 16px;
    font-size: 14px;
  }

  /* Related grid drops to 1 col at 640px */
  .related-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ── Mobile Small (max 480px) ── */
@media (max-width: 480px) {

  :root {
    --text-5xl : 28px;
    --text-4xl : 24px;
    --text-3xl : 22px;
    --text-2xl : 18px;
  }

  .navbar-logo .logo-main   { font-size: 17px; }
  .navbar-logo .logo-tagline { font-size: 8px; }

  .hero {
    padding: 40px 0 30px;
  }

  .hero-heading  { font-size: 24px; }
  .hero-subtext  { font-size: 14px; }
  .hero-badge    { display: none; }

  .card { padding: 20px 16px; }

  .article-header .article-meta {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
  }

  .calc-result-box .result-amount { font-size: 30px; }

  .footer-brand .logo-main { font-size: 18px; }

  .article-tags { gap: 6px; }

  .article-tags a {
    font-size: 11px;
    padding: 4px 10px;
  }

  /* Related grid to 1 col on small mobile */
  .related-grid {
    grid-template-columns: 1fr !important;
  }

  /* Comparison table min-width smaller */
  .comparison-table { min-width: 420px; }

  .btn {
    padding: 10px 18px;
    font-size: 0.85rem;
  }

  .btn-full { width: 100%; }
}

/* ── Mobile XS (max 360px) ── */
@media (max-width: 360px) {

  .container {
    padding: 0 12px;
  }

  .hero-heading { font-size: 22px; }

  .navbar-inner { padding: 0 12px; }

  .navbar-logo .logo-main { font-size: 15px; }

  .section-heading h2 { font-size: 18px; }

  .article-content {
    padding: 20px 12px;
  }

  .article-header h1 {
    font-size: 1.25rem !important;
  }

  .comparison-table { min-width: 360px; }

  .calc-form  { padding: 18px 12px; }

  .footer-top { padding: 0 12px 28px; }

  .btn {
    padding: 10px 16px;
    font-size: 13px;
  }

  .related-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ══════════════════════════════════════════
   PRINT STYLES
══════════════════════════════════════════ */
@media print {

  .navbar,
  .footer,
  .whatsapp-float,
  .back-to-top,
  .cookie-banner,
  .hero-buttons,
  .article-sidebar,
  .calc-sidebar,
  .related-articles {
    display: none !important;
  }

  body {
    background-color: white;
    color: black;
    font-size: 12pt;
  }

  .article-content {
    box-shadow: none;
    padding: 0;
  }

  .article-header {
    background-color: white;
    color: black;
    padding: 20px 0;
  }

  .article-header h1 {
    color: black;
    font-size: 18pt;
  }

  .calc-result-box {
    border: 2px solid #333;
    background: white;
  }

  .calc-result-box .result-amount {
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }
}