/* =====================================================================
   Teach Quran Online - responsive layer
   Loaded LAST on the public site, the student/tutor portals and the admin
   panel. Everything here only applies below the desktop breakpoints, so it
   never changes the desktop look.
   ===================================================================== */

/* ---------- global guards ---------- */
@media (max-width: 991px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  img, svg, video, iframe { max-width: 100%; }
  .container { padding-left: 16px; padding-right: 16px; }
  .viewing-bar { flex-wrap: wrap; gap: 6px 10px; font-size: 13px; padding: 8px 12px; line-height: 1.35; }
  .viewing-bar a { white-space: nowrap; }
}

/* ---------- public site: tablets and phones ---------- */
@media (max-width: 991px) {
  .white-section { padding: 56px 0; }
  .white-section.pb-0 { padding-bottom: 0; }
  .course-side-img { max-width: 280px; margin: 12px auto 0; display: block; }
  .why-tutor-side-img { max-width: 300px; }
}

/* ---------- public site: phones ---------- */
@media (max-width: 767px) {
  /* rhythm */
  .white-section { padding: 44px 0; }
  .white-section.pb-0 { padding-bottom: 0; }
  .section-heading { margin-bottom: 16px; }
  .section-heading h2, .heading-area h2, .pricing-area-head h3 { font-size: 25px; line-height: 1.25; }
  .section-heading p, .heading-area p { font-size: 15px; line-height: 1.6; }
  .heading-ayat { font-size: 22px; line-height: 1.7; margin-bottom: 2px; }

  /* home hero: keep the text readable over the mosque */
  .home-banner { height: auto; max-height: none; min-height: 0; padding: 40px 0 22px; background-position: 72% 45%; }
  .home-banner::after { content: ''; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(180deg, rgba(6,26,17,.62) 0%, rgba(6,26,17,.38) 55%, rgba(6,26,17,.72) 100%); }
  .home-banner .container, .home-banner .banner-center-container { position: relative; top: auto; left: auto; transform: none; z-index: 2; }
  .banner-heading h3 { font-size: 18px; margin-bottom: 6px; }
  .banner-heading h1 { font-size: 29px; line-height: 1.2; overflow-wrap: anywhere; }
  .banner-heading p.after-head-p, .banner-heading p.after-head-normal-p { font-size: 15px; }
  .ticker-track span { font-size: 13px; padding: 0 22px; }

  /* inner page banners: no more full-screen green blocks */
  .inner-banner { max-height: 270px; }
  .inner-banner .banner-heading h1 { font-size: 30px; padding-bottom: 42px; }
  .inner-banner .banner-heading p.after-head-normal-p { font-size: 15px; }

  /* feature / benefit cards: tighter rows, smaller icons */
  .single-service { padding: 14px; margin: 6px 0; align-items: flex-start; }
  .service-img { width: 46px; margin-right: 12px; }
  .single-service h3 { font-size: 17px; margin-bottom: 4px; line-height: 1.3; }
  .single-service p { font-size: 14px; line-height: 1.5; margin-bottom: 6px; }

  /* three steps: smaller circles, less air */
  .courseplan > img { max-width: 96px; margin-bottom: 10px; }
  .courseplan > h3 { font-size: 17px; }
  .courseplan > p { padding: 0 4px; font-size: 14px; }
  .steps-row > div { margin-bottom: 22px; }
  .steps-row > div:last-child { margin-bottom: 4px; }

  /* course selector tabs: swipe strip that starts at the left */
  .pricing-top-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; overflow: visible; }
  .pricing-top-tabs .nav-item { margin: 0; min-width: 0; }
  .pricing-top-tabs .nav-item .nav-link { padding: 10px 6px; font-size: 12px; line-height: 1.2; text-align: center; white-space: normal; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
  .pricing-top-tabs .nav-item .nav-link img { max-height: 34px; margin-bottom: 6px; }
  /* inner pages: the tabs block sits right under a dark banner, so make it light there */
  .tabs-light .pricing-top-section { background: var(--cream) url(../images/ornament/pattern-light.svg); }
  .tabs-light .pricing-top-section .section-heading h2 { color: var(--text); }
  .tabs-light .pricing-top-section .section-heading p { color: var(--muted); }
  .tabs-light .pricing-top-section .heading-ayat { color: var(--green); }
  .tabs-light .pricing-top-section .section-heading.white-text h2::before { background-image: url(../images/ornament/divider.svg); }

  /* course panels: centred heading, sensible illustration size, aligned buttons */
  .tab-pane .section-heading.small-img-head { text-align: center; }
  .tab-pane .section-heading.small-img-head h2::before { left: 50%; transform: translateX(-50%); }
  .tab-pane .section-heading.small-img-head img { display: block; margin-left: auto; margin-right: auto; }
  .course-side-img { max-width: 230px; margin: 6px auto 0; display: block; }
  .small-link-area { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: center; }
  .single-course img { max-height: 190px; object-fit: cover; }
  .single-course-detail h3 { font-size: 19px; }

  /* buttons that sat on the left under centred text */
  .center-link-area, .lesson-demo-section .ls-cta { text-align: center; }
  .lesson-demo-section .filled-link, .lesson-demo-section .btn-green { display: inline-block; margin-left: auto; margin-right: auto; }
  .filled-link, .center-link-area a { padding: 12px 26px; font-size: 15px; }

  /* pricing cards: flat compact header instead of the tall arch */
  .single-pricing { margin-bottom: 18px; }
  .single-pricing:hover, .pricing-row:not(:hover) .single-pricing[data-recommended="1"] { transform: none; }
  .single-pricing-head { height: 100px; background: #fff; border-radius: 14px 14px 0 0; }
  .single-pricing-head svg { display: none; }
  .single-pricing-head img { top: 50%; max-height: 60px; }
  .pricing-row:not(:hover) .single-pricing[data-recommended="1"] .single-pricing-head { background: var(--green); }
  .single-pricing .ribbon { top: 14px; }
  .single-inner-pricing { padding: 0 14px 20px; }
  .single-inner-pricing ul li { font-size: 14px; }
  .nav-tabs.pricing-tabs { border: 0; justify-content: flex-start !important; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; padding: 0 2px 6px; }
  .nav-tabs.pricing-tabs::-webkit-scrollbar { display: none; }
  .nav-tabs.pricing-tabs .nav-item { flex: 0 0 auto; }
  .nav-tabs.pricing-tabs .nav-link { white-space: nowrap; padding: 9px 16px; font-size: 14px; }
  .scroll-hint { display: none; }
  .billing-toggle { width: 100%; justify-content: center; }
  .billing-toggle button { padding: 8px 10px; font-size: 12.5px; }

  /* about page illustrations */
  .why-tutor-side-img { max-width: 220px; }
  .why-qm-inner-section .section-heading:not(.text-center) h2::before { left: 0; transform: none; }

  /* contact form */
  .contact-form .iti { width: 100%; display: block; }
  .contact-form .contact-form-input input, .contact-form .contact-form-input textarea { font-size: 15px; }
  .contact-form-submit, .contact-form .filled-link { width: 100%; display: block; text-align: center; }

  /* play & learn flip cards: two per row */
  .pl-cards { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
  .pl-card { height: 118px; }
  .pl-card h4 { font-size: 16px; overflow-wrap: anywhere; line-height: 1.2; }
  .pl-card p { font-size: 12.5px; }

  /* footer */
  .footer-absolute-img img { height: 120px; }
  .before-footer-div { padding-bottom: 130px; }
  .footer-links li { margin: 0 8px 6px; }
  .footer-links li a { font-size: 13px; }
  .payment-logos img, .footer-payment img { max-height: 30px; }
}
@media (max-width: 420px) {
  .banner-heading h3 { font-size: 17px; }
  .banner-heading h1 { font-size: 26px; }
  .banner-heading p.after-head-p, .banner-heading p.after-head-normal-p { font-size: 14px; }
  .section-heading h2, .heading-area h2, .pricing-area-head h3 { font-size: 23px; }
  .inner-banner .banner-heading h1 { font-size: 27px; }
}

/* ---------- student + tutor portals ---------- */
@media (max-width: 991px) {
  .portal-section { padding: 16px 0 44px; min-height: 0; }
  .portal-side { margin-bottom: 12px !important; }

  /* the big profile card becomes a one-line strip */
  .portal-profile { display: flex; align-items: center; gap: 12px; text-align: left !important; padding: 12px 14px !important; margin-bottom: 10px !important; }
  .portal-profile > i { font-size: 26px !important; margin: 0 !important; flex: 0 0 auto; }
  .portal-profile .portal-who { min-width: 0; }
  .portal-profile h5 { font-size: 15px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .portal-profile small, .portal-profile .small { font-size: 12px; }
  .portal-profile .portal-who > .small { display: inline-block; margin: 0 0 0 4px !important; }

  /* the vertical menu becomes a horizontal, swipeable tab strip */
  .portal-nav { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; border-radius: 8px; }
  .portal-nav::-webkit-scrollbar { display: none; }
  .portal-nav a { flex: 0 0 auto; white-space: nowrap; border-bottom: 0; border-right: 1px solid #eee; padding: 11px 14px; font-size: 13.5px; }
  .portal-nav a:last-child { border-right: 0; }
  .portal-nav a i { width: auto; margin-right: 5px; }

  .portal-card { padding: 18px 16px; }
  .portal-card h1, .portal-card h2 { font-size: 20px; margin-bottom: 14px; }
  .portal-card .form-control { height: 42px; }
  .stat-tile { padding: 14px 6px; }
  .stat-tile h3 { font-size: 26px; }
  .stat-tile p { font-size: 12px; line-height: 1.25; }
  .portal-card .d-flex.justify-content-between { flex-wrap: wrap; gap: 8px; }
}

/* ---------- data tables (portals + admin) ---------- */
@media (max-width: 767px) {
  /* scroll edge-to-edge inside the card instead of squeezing every column */
  .portal-card .table-responsive, .card .table-responsive, .card-body .table-responsive { margin-left: -16px; margin-right: -16px; padding: 0 16px; width: auto; }
  .table-responsive { border: 0; }
  .table-responsive > .table { min-width: 560px; margin-bottom: 0; }
  .table-responsive > .table.table-wide { min-width: 760px; }
  .table thead th { white-space: nowrap; }
  .table td:first-child { white-space: nowrap; }
  .table td .btn { white-space: nowrap; }
  .table td, .table th { padding: .55rem .5rem; font-size: 13.5px; }
}

/* ---------- admin panel ---------- */
@media (max-width: 991px) {
  .admin-topbar { padding: 0 12px; }
  .admin-brand img { height: 30px; margin-right: 6px; }
  .admin-top-link { margin-left: 12px; white-space: nowrap; }
  .admin-backdrop { position: fixed; top: 60px; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.35); z-index: 55; display: none; }
  .admin-backdrop.show { display: block; }
  .admin-sidebar { box-shadow: 4px 0 20px rgba(0,0,0,.25); }
  .admin-main { padding: 14px 12px; }
  .admin-page-head { margin-bottom: 14px; }
  .admin-page-head h1 { font-size: 19px; }
  .tile { padding: 12px; margin-bottom: 12px; }
  .tile i { width: 40px; height: 40px; font-size: 20px; margin-right: 10px; flex: 0 0 auto; }
  .tile h3 { font-size: 20px; }
  .tile p { font-size: 11.5px; line-height: 1.25; }
  .card { margin-bottom: 14px; }
  .card-body { padding: 14px 16px; }
  .filter-bar { gap: 6px; }
  .filter-bar .form-control, .filter-bar .custom-select { max-width: 100%; }
  .nav-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tabs .nav-link { white-space: nowrap; }
}
@media (max-width: 575px) {
  .admin-brand span { display: none; }
  .admin-page-head { flex-direction: column; align-items: stretch; }
  .admin-page-head > div { display: flex; flex-wrap: wrap; gap: 6px; }
  .admin-page-head .btn { white-space: nowrap; }
  .tile { flex-direction: column; align-items: flex-start; }
  .tile i { margin: 0 0 8px; }
  .form-inline .form-control, .form-inline .custom-select { width: 100%; }
}

@media (max-width: 991px) { .wa-bubble { display: none !important; } }  /* the bottom bar already has WhatsApp */
