/**
 * PRARVI EDUCONNECT — mobile-first responsive fixes
 * Loaded last in base.html (overrides page <style> blocks)
 */

/* ── Global foundation ─────────────────────────── */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    width: 100%;
}

/* Default: images keep intrinsic size; cover photos listed below */
img,
video,
svg {
    max-width: 100%;
    height: auto;
}

iframe,
embed,
object {
    max-width: 100%;
}

.container {
    width: 100%;
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
}

[class*="grid"],
[class*="wrapper"],
[class*="row"],
.card {
    min-width: 0;
}

h1, h2, h3, h4 {
    overflow-wrap: break-word;
}

p, li, td, th {
    overflow-wrap: break-word;
}

a, small {
    overflow-wrap: anywhere;
}

/* Full-bleed / cover images */
.destination-hero-bg img,
.dest-cta-bg img,
.cta-bg-img img,
.page-hero-bg img,
.services-hero-bg img,
.hero-image-card img,
.featured-card > img,
.support-image-card > img,
.support-landing-image > img,
.scholarship-image img,
.visa-image-box img,
.process-image img,
.banner-bg-img img,
[class$="-bg"]:not(.dest-guide-blob) {
    width: 100%;
}

.table-wrapper,
.table-responsive-box,
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-section .table-wrapper {
    overflow: visible !important;
    -webkit-overflow-scrolling: auto;
}

.admin-section #leadsTable {
    table-layout: fixed;
    width: 100%;
}

.dense-corporate-table {
    min-width: 640px;
}

.universal-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 32px;
    padding: 56px 24px;
    margin: 0 0 24px;
    background-size: cover;
    background-position: center;
    border-radius: var(--radius, 28px);
    color: #fff;
}

.universal-hero-content {
    flex: 1 1 280px;
    min-width: 0;
}

.universal-hero-content h1 {
    font-size: clamp(28px, 5vw, 42px);
    line-height: 1.2;
    margin-top: 12px;
}

.universal-hero-img-node {
    flex: 0 1 280px;
    position: relative;
    max-width: 100%;
}

.universal-hero-img-node img {
    border-radius: 20px;
    max-height: 220px;
    object-fit: cover;
    width: 100%;
}

/* ── Tablet / mobile nav (≤1280px) ─────────────── */

@media (max-width: 1280px) {

    :root {
        --navbar-height: 84px;
    }

    .menu-btn {
        display: block !important;
    }

    .apply-btn {
        display: none !important;
    }

    .nav-wrapper {
        height: 84px !important;
    }

    .logo img {
        height: 64px !important;
        max-height: 64px !important;
        min-height: 64px !important;
        width: auto !important;
        max-width: none !important;
    }

    .logo-text h2 {
        font-size: 18px !important;
    }

    .nav-links {
        position: fixed !important;
        top: 84px !important;
        left: -100% !important;
        width: 100% !important;
        max-width: 100vw !important;
        height: calc(100dvh - 84px) !important;
        background: #fff !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0 !important;
        padding: 16px 20px 32px !important;
        margin: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        transition: left 0.35s ease !important;
        z-index: 998 !important;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    }

    .nav-links.active {
        left: 0 !important;
    }

    .nav-links li {
        width: 100%;
        border-bottom: 1px solid #f1f5f9;
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links a {
        display: block !important;
        width: 100% !important;
        padding: 16px 8px !important;
        font-size: 17px !important;
    }

    .nav-links a::after {
        display: none !important;
    }

    .section-title {
        font-size: clamp(32px, 5vw, 42px) !important;
    }
}

/* ── Large tablet (≤1200px) ─────────────────────── */

@media (max-width: 1200px) {

    .country-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .overview-strip-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .featured-grid {
        grid-template-columns: 1fr !important;
    }

    .featured-right {
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto !important;
    }
}

/* ── Tablet layouts (≤1100px) ───────────────────── */

@media (max-width: 1100px) {

    .hero-wrapper,
    .contact-hero-wrapper,
    .faq-wrapper,
    .loan-hero-wrapper,
    .scholarship-wrapper,
    .visa-hero-wrapper,
    .process-wrapper,
    .dest-guide-inner,
    .calculator-wrapper,
    .welcome-banner,
    .policy-layout,
    .faq-layout {
        grid-template-columns: 1fr !important;
        gap: 36px !important;
    }

    .services-grid,
    .support-header {
        grid-template-columns: 1fr !important;
    }

    .support-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .why-side-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .overview-strip-grid,
    .gallery-grid,
    .courses-grid,
    .cost-grid,
    .why-grid,
    .country-selector-grid,
    .featured-countries-grid,
    .challenge-grid,
    .scholarship-grid,
    .loan-grid,
    .partner-grid,
    .counsellors-grid,
    .admin-stats,
    .faq-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .university-grid,
    .dest-grid,
    .country-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .dest-grid {
        grid-template-rows: auto !important;
    }

    .dest-tile.large {
        grid-row: span 1 !important;
    }

    .support-grid,
    .office-grid,
    .charts-row {
        grid-template-columns: 1fr 1fr !important;
    }

    .stories-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .testimonial-strip {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .tstrip-divider {
        display: none !important;
    }

    .journey-photo-strip,
    .hero-images-row {
        flex-wrap: wrap;
        height: auto !important;
    }

    .jstrip-item {
        min-height: 180px;
        flex: 1 1 45%;
    }

    .timeline-wrapper {
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 12px;
        flex-wrap: nowrap;
        gap: 20px !important;
    }

    .timeline-line {
        display: none !important;
    }

    .timeline-step {
        flex-shrink: 0;
        min-width: 88px;
    }

    .analytics-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 16px;
    }

    .scholarship-image img {
        height: min(480px, 50vh) !important;
        width: 100% !important;
    }
}

/* ── Mobile (≤768px) ────────────────────────────── */

@media (max-width: 768px) {

    .container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    section {
        padding: 48px 0 !important;
    }

    section.destination-hero,
    section.country-selector-section,
    section.dest-guide-section,
    section.featured-section,
    section.why-abroad-section,
    section.dest-bottom-cta-section {
        padding-left: 0;
        padding-right: 0;
    }

    .section-header {
        margin-bottom: 32px;
    }

    .section-title {
        font-size: clamp(26px, 7vw, 32px) !important;
        line-height: 1.2 !important;
        margin-bottom: 14px !important;
    }

    .section-description,
    .section-desc {
        font-size: 15px !important;
        line-height: 1.75 !important;
    }

    /* Heroes */
    section[class$="-hero"]:not(.services-hero),
    .destination-hero {
        min-height: auto !important;
        display: block !important;
    }

    section[class$="-hero"]:not(.services-hero) .container,
    .destination-hero > .container {
        padding: 88px 16px 48px !important;
        width: 100% !important;
    }

    .hero-content h1,
    [class*="-hero-content"] h1,
    .destination-heading h1,
    .contact-content h1,
    .services-hero-content h1,
    .scholarship-content h1,
    .visa-hero-content h1,
    .loan-hero-content h1,
    .page-hero-content h1,
    .welcome-left h1 {
        font-size: clamp(28px, 8vw, 36px) !important;
        line-height: 1.15 !important;
        margin-top: 12px !important;
        margin-bottom: 16px !important;
    }

    .hero-content p,
    [class*="-hero-content"] p,
    .destination-heading p,
    .page-hero-content p {
        font-size: 15px !important;
        line-height: 1.75 !important;
    }

    .hero-section {
        padding-top: 24px !important;
    }

    .hero-wrapper {
        gap: 28px !important;
    }

    /* All multi-column → single column on phones */
    .services-grid,
    .why-grid,
    .why-side-grid,
    .stories-grid,
    .overview-strip-grid,
    .gallery-grid,
    .courses-grid,
    .cost-grid,
    .university-grid,
    .country-selector-grid,
    .featured-countries-grid,
    .country-grid,
    .dest-grid,
    .support-grid,
    .office-grid,
    .loan-types-grid,
    .form-grid,
    .testimonial-strip,
    .challenge-grid,
    .scholarship-grid,
    .loan-grid,
    .partner-grid,
    .counsellors-grid,
    .admin-stats,
    .charts-row,
    .featured-grid,
    .featured-right,
    .faq-stats-grid {
        grid-template-columns: 1fr !important;
    }

    .featured-right {
        grid-template-rows: auto !important;
    }

    /* Country selector cards */
    .country-grid {
        gap: 14px !important;
    }

    .country-card {
        min-height: 0 !important;
        padding: 16px 10px !important;
        border-radius: 20px !important;
    }

    .country-card img {
        width: 52px !important;
        height: 52px !important;
        margin-bottom: 10px !important;
    }

    .country-card span {
        font-size: 12px !important;
        line-height: 1.35 !important;
    }

    /* Overview stats strip (country pages) */
    .overview-strip {
        margin-top: 0 !important;
        padding-top: 8px !important;
    }

    .overview-strip-grid {
        gap: 12px !important;
    }

    .overview-item {
        padding: 18px 14px !important;
    }

    /* Destinations guide panel */
    .dest-guide-panel {
        padding: 24px 18px !important;
        border-radius: 24px !important;
    }

    .dest-guide-left h3 {
        font-size: clamp(22px, 6vw, 28px) !important;
        max-width: none !important;
    }

    .dest-guide-left > p {
        max-width: none !important;
        font-size: 14px !important;
    }

    .dest-guide-right {
        max-width: none !important;
        margin-left: 0 !important;
    }

    .dest-guide-stat strong {
        font-size: 36px !important;
    }

    .dest-guide-stat {
        padding: 16px !important;
    }

    .dest-guide-card {
        padding: 14px 16px !important;
    }

    .dest-guide-flags {
        flex-wrap: wrap;
        gap: 8px;
    }

    .dest-guide-more {
        margin-left: 0 !important;
        margin-top: 4px;
    }

    /* Featured country cards */
    .large-card,
    .small-card,
    .featured-card {
        min-height: 240px !important;
        border-radius: 24px !important;
    }

    .featured-content h2 {
        font-size: clamp(22px, 6vw, 28px) !important;
    }

    /* Buttons */
    .hero-buttons,
    .dest-hero-btns,
    .dest-cta-buttons,
    .dest-cta-row,
    .loan-hero-buttons,
    .country-cta-buttons,
    .service-cta-buttons,
    .why-contact-btns,
    .contact-hero-buttons,
    .dest-guide-actions,
    .visa-hero-buttons,
    .cta-buttons {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 12px !important;
    }

    .primary-btn,
    .secondary-btn {
        width: 100% !important;
        max-width: 100% !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    .hero-image-card img {
        height: min(360px, 50vh) !important;
        width: 100% !important;
    }

    .hero-stats,
    [class*="-hero"] .hero-stats {
        flex-direction: column !important;
        gap: 10px !important;
        margin-top: 28px !important;
    }

    .hero-stat-card,
    .hero-stats div {
        min-width: 0 !important;
        width: 100% !important;
    }

    .floating-card,
    .visa-floating-card {
        left: 12px !important;
        right: 12px !important;
        bottom: 12px !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        border-radius: 20px !important;
        padding: 12px 14px !important;
    }

    .floating-card p {
        font-size: 12px !important;
    }

    /* Services page */
    .services-hero-head {
        min-height: 0 !important;
    }

    .services-hero-head .container {
        padding: 88px 16px 40px !important;
    }

    .services-hero-gallery {
        padding: 0 16px 20px !important;
    }

    .hero-images-row {
        flex-direction: column !important;
        height: auto !important;
        gap: 10px !important;
    }

    .hero-img-tile,
    .hero-img-tile.tall,
    .hero-img-col {
        flex: none !important;
        width: 100% !important;
        min-height: 120px !important;
    }

    .journey-photo-strip {
        flex-direction: column !important;
    }

    .jstrip-item {
        width: 100% !important;
        flex: none !important;
        min-height: 140px !important;
    }

    .jstrip-arrow {
        width: 100% !important;
        height: 36px !important;
        transform: rotate(90deg) !important;
    }

    .support-card {
        min-height: 0 !important;
        padding: 28px 22px !important;
    }

    .support-card h3 {
        font-size: 24px !important;
    }

    .support-image-card,
    .support-landing-image {
        min-height: 200px !important;
    }

    .support-landing-image img,
    .support-image-card img {
        width: 100% !important;
        min-height: 200px !important;
        object-fit: cover !important;
    }

    /* Cards */
    .service-card,
    .story-content,
    .challenge-card,
    .scholarship-card,
    .why-card {
        padding: 22px 18px !important;
    }

    .why-main-card {
        min-height: 0 !important;
        padding: 28px 20px !important;
    }

    .why-main-card h2 {
        font-size: 28px !important;
    }

    .scholarship-image img {
        height: min(300px, 42vh) !important;
        width: 100% !important;
        border-radius: 20px !important;
    }

    /* CTAs */
    .cta-box,
    .service-cta,
    .country-cta-box,
    .contact-cta,
    .dest-cta-box,
    .visa-cta {
        padding: 40px 18px !important;
        border-radius: 24px !important;
    }

    .dest-cta-box {
        padding: 48px 18px !important;
    }

    .cta-box h2,
    .service-cta h2,
    .country-cta-content h2,
    .contact-cta h2,
    .dest-cta-content h2,
    .visa-cta h2,
    .cta-content h2 {
        font-size: clamp(24px, 6vw, 30px) !important;
    }

    /* Contact */
    .hero-image-strip {
        flex-direction: column !important;
    }

    .banner-img-wrap {
        height: 180px !important;
    }

    .banner-stats {
        flex-wrap: wrap !important;
        gap: 16px !important;
        justify-content: center !important;
    }

    .bstat-divider {
        display: none !important;
    }

    .faq-sidebar {
        position: static !important;
        flex-direction: column !important;
    }

    .faq-q {
        font-size: 15px !important;
        padding: 16px 18px !important;
        gap: 12px !important;
    }

    .faq-a {
        padding: 16px 18px !important;
    }

    .process-wrapper {
        gap: 28px !important;
    }

    .process-image img {
        max-height: 280px !important;
        width: 100% !important;
        object-fit: cover !important;
        border-radius: 20px !important;
    }

    .calculator-card {
        padding: 24px 18px !important;
    }

    .welcome-banner {
        padding: 28px 20px !important;
    }

    .table-header,
    .table-filters {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .table-filters input,
    .table-filters select {
        width: 100% !important;
    }

    .universal-hero {
        flex-direction: column !important;
        padding: 40px 18px !important;
        text-align: center;
    }

    footer {
        padding-top: 48px !important;
    }

    .footer-grid {
        gap: 28px !important;
    }

    .footer-bottom {
        font-size: 12px !important;
        text-align: center;
        padding: 0 12px 24px;
    }

    /* Floating actions */
    .float-actions {
        right: max(12px, env(safe-area-inset-right, 0px));
        bottom: max(12px, env(safe-area-inset-bottom, 0px));
        gap: 10px;
    }

    .whatsapp-btn,
    #chatToggle {
        width: 52px !important;
        height: 52px !important;
        font-size: 24px !important;
    }

    #chatWindow {
        width: calc(100vw - 20px) !important;
        right: 10px !important;
        left: 10px !important;
        bottom: max(140px, calc(80px + env(safe-area-inset-bottom, 0px))) !important;
        max-height: min(520px, calc(100dvh - 160px)) !important;
    }

    .opt-btn.wide {
        flex: 1 1 100% !important;
    }

    .stories-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 14px !important;
    }

    .story-nav {
        width: 100%;
        justify-content: space-between;
    }

    .story-card {
        width: 100%;
    }

    .card:hover,
    .why-card:hover,
    .country-card:hover {
        transform: none !important;
    }
}

/* ── Small phones (≤480px) ───────────────────────── */

@media (max-width: 480px) {

    .logo-text h2 {
        font-size: 15px !important;
    }

    .logo-text small {
        display: none;
    }

    .logo img {
        height: 56px !important;
        max-height: 56px !important;
        min-height: 56px !important;
        max-width: none !important;
    }

    .section-title {
        font-size: 24px !important;
    }

    .primary-btn,
    .secondary-btn {
        padding: 13px 18px !important;
        font-size: 14px !important;
    }

    .country-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .country-card {
        padding: 14px 8px !important;
    }

    .country-card img {
        width: 44px !important;
        height: 44px !important;
    }

    .country-card span {
        font-size: 11px !important;
    }

    .overview-strip-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .dest-guide-panel {
        padding: 20px 14px !important;
    }

    .faq-stats-grid {
        grid-template-columns: 1fr !important;
    }

    img.uni-logo {
        width: 56px !important;
        height: 56px !important;
    }
}

/* ── Very narrow (≤360px) ────────────────────────── */

@media (max-width: 360px) {

    .country-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .overview-strip-grid {
        grid-template-columns: 1fr !important;
    }

    .logo-text h2 {
        font-size: 13px !important;
    }
}
