/* ============================================
   GLOBAL MOBILE RESPONSIVE STYLES
   Key Konnect (Pvt) Ltd. - All Pages
   ============================================ */

/* Prevent horizontal overflow on all pages */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* ---- MOBILE MENU OVERLAY ---- */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(11, 19, 37, 0.97);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.mobile-menu-overlay .close-btn {
    position: absolute;
    top: 28px;
    right: 28px;
    font-size: 32px;
    color: #fff;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 10001;
    transition: transform 0.3s ease;
}

.mobile-menu-overlay .close-btn:hover {
    transform: rotate(90deg);
}

.mobile-menu-overlay nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.mobile-menu-overlay nav a {
    color: #e5e7eb;
    font-size: 20px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 1px;
    transition: color 0.3s ease, transform 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.mobile-menu-overlay nav a:hover {
    color: #ffffff;
    transform: scale(1.05);
}

.mobile-menu-overlay .mobile-cta {
    margin-top: 24px;
    background: #ffffff;
    color: #0b1325;
    font-weight: 700;
    padding: 14px 36px;
    border-radius: 8px;
    font-size: 16px;
    text-decoration: none;
    transition: background 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15);
}

.mobile-menu-overlay .mobile-cta:hover {
    background: #e5e7eb;
}

/* ---- HEADER MOBILE FIXES ---- */
@media (max-width: 1023px) {
    header {
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }

    header img.h-16 {
        height: 48px !important;
    }
}

@media (max-width: 640px) {
    header {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    header img.h-16,
    header img[alt="Key Konnect Logo"] {
        height: 40px !important;
    }
}

/* ---- HERO SECTIONS MOBILE ---- */
@media (max-width: 768px) {
    /* Fix fixed background attachment on mobile (breaks on iOS) */
    .hero-bg,
    .hero-section,
    .tech-bg {
        background-attachment: scroll !important;
    }

    /* Index hero */
    section.hero-bg.min-h-screen {
        min-height: 85vh;
        padding-top: 100px;
    }
}

@media (max-width: 480px) {
    /* Smaller hero text */
    h1 {
        word-break: break-word;
    }

    /* Fix CTA buttons stacking */
    .flex.flex-col.sm\:flex-row {
        width: 100%;
    }

    .flex.flex-col.sm\:flex-row a {
        width: 100%;
        text-align: center;
        font-size: 14px;
        padding: 12px 20px;
    }
}

/* ---- STATS SECTION (Index) ---- */
@media (max-width: 640px) {
    .grid.grid-cols-2.md\:grid-cols-4 {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .grid.grid-cols-2.md\:grid-cols-4 .font-heading.font-bold.text-4xl {
        font-size: 28px;
    }

    .grid.grid-cols-2.md\:grid-cols-4 .text-sm {
        font-size: 11px;
    }
}

/* ---- ABOUT SECTION ---- */
@media (max-width: 768px) {
    .flex.flex-col.lg\:flex-row {
        flex-direction: column !important;
    }

    .w-full.lg\:w-1\/2 {
        width: 100% !important;
    }
}

/* ---- LEADERSHIP CARDS ---- */
@media (max-width: 768px) {
    .grid.grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* Leadership hero CEO card */
    .flex.flex-col.md\:flex-row {
        flex-direction: column !important;
    }

    .w-full.md\:w-\[350px\] {
        width: 100% !important;
        height: 280px !important;
    }

    .w-full.md\:w-\[300px\] {
        width: 100% !important;
    }
}

/* ---- DIVISION PAGE ---- */
@media (max-width: 640px) {
    .hero-section {
        padding: 120px 16px 60px !important;
    }

    .hero-title {
        font-size: 26px !important;
    }

    .hero-subtitle {
        font-size: 18px !important;
    }

    .hero-desc {
        font-size: 13px !important;
    }

    .operating-model h2 {
        font-size: 24px !important;
    }

    .operating-model p {
        font-size: 15px !important;
        padding: 0 8px;
    }
}

/* ---- APP PAGE ---- */
@media (max-width: 768px) {
    /* App hero badges */
    .bg-white.text-primary.font-bold.px-6.py-3 span.text-xl {
        font-size: 14px;
    }

    /* App hero heading */
    .font-heading.font-black.text-5xl.md\:text-7xl {
        font-size: 32px !important;
        line-height: 1.15;
    }
}

@media (max-width: 480px) {
    /* Features/Download box */
    .flex.flex-col.sm\:flex-row.gap-8 {
        flex-direction: column;
    }

    .w-full.sm\:w-1\/2 {
        width: 100% !important;
    }

    /* Remove border-right on mobile stacked layout */
    .w-full.sm\:w-1\/2.border-r {
        border-right: none !important;
        border-bottom: 1px solid #e5e7eb;
        padding-bottom: 16px;
        padding-right: 0;
    }
}

/* ---- DIGITAL SERVICES PAGE ---- */
@media (max-width: 768px) {
    /* Dashboard mockup */
    .w-full.aspect-video.bg-\[\#1e1e2f\] {
        min-height: 200px;
    }

    /* Dashboard internal: hide sidebar on very small */
    .w-full.aspect-video .w-12 {
        display: none;
    }
}

@media (max-width: 640px) {
    /* Profile card */
    .bg-white.rounded-3xl.shadow-\[0_0_40px {
        flex-direction: column;
    }

    .w-full.md\:w-64 {
        width: 100% !important;
        height: 200px !important;
    }

    /* App publishing grid */
    .grid.grid-cols-1.sm\:grid-cols-2.md\:grid-cols-4 {
        grid-template-columns: 1fr;
    }

    /* Store buttons width fix */
    .flex.flex-row.gap-4.w-\[300px\] {
        width: 100% !important;
        max-width: 280px;
    }
}

/* ---- CONTACT PAGE ---- */
@media (max-width: 768px) {
    .hero-section {
        padding-top: 140px !important;
        padding-bottom: 60px !important;
    }
}

@media (max-width: 640px) {
    .grid.grid-cols-1.md\:grid-cols-2.gap-6 input,
    .grid.grid-cols-1.md\:grid-cols-2.gap-6 textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .contact-form-input {
        font-size: 16px !important; /* Prevents iOS zoom */
    }
}

/* ---- CSR PAGE ---- */
@media (max-width: 640px) {
    /* Program overview image */
    .md\:w-\[35\%\] {
        width: 100% !important;
    }

    .md\:w-\[65\%\] {
        width: 100% !important;
    }

    /* Governance boxes */
    .border-2.border-\[\#0a1d37\].rounded-2xl {
        padding: 20px !important;
    }
}

/* ---- LEGAL & COMPLIANCE / LEGAL SERVICES ---- */
@media (max-width: 768px) {
    .grid.grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* ---- KEY MARKETING PAGE ---- */
@media (max-width: 768px) {
    /* Location cards */
    .flex.flex-wrap.justify-center.gap-6 > div {
        width: calc(50% - 12px) !important;
        min-width: unset !important;
    }

    /* Leadership card */
    .bg-white.rounded-\[3rem\] {
        padding: 24px !important;
        border-radius: 1.5rem !important;
    }

    .bg-white.rounded-\[3rem\] .w-full.md\:w-\[300px\] {
        height: 250px !important;
    }
}

@media (max-width: 480px) {
    /* Location cards full width on very small */
    .flex.flex-wrap.justify-center.gap-6 > div {
        width: 100% !important;
    }
}

/* ---- TRADING DIVISION & TRADEX SOLAR ---- */
@media (max-width: 768px) {
    .flex.flex-col.md\:flex-row {
        flex-direction: column !important;
    }

    .md\:w-1\/2 {
        width: 100% !important;
    }
}

/* ---- PROPERTY ADVISORY ---- */
@media (max-width: 768px) {
    .flex.flex-col.lg\:flex-row {
        flex-direction: column !important;
    }
}

/* ---- FOOTER MOBILE ---- */
@media (max-width: 768px) {
    footer .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-4 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    footer .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-4 {
        grid-template-columns: 1fr;
    }

    footer {
        padding-top: 40px !important;
    }
}

/* ---- GENERAL TYPOGRAPHY MOBILE ---- */
@media (max-width: 480px) {
    .text-4xl {
        font-size: 1.75rem !important;
    }

    .text-3xl {
        font-size: 1.5rem !important;
    }

    .text-2xl {
        font-size: 1.25rem !important;
    }

    /* Prevent images from overflowing */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Fix any absolutely positioned elements that may overflow */
    section {
        overflow-x: hidden;
    }
}

/* ---- SMOOTH SCROLL ---- */
html {
    scroll-behavior: smooth;
}

/* ---- TOUCH-FRIENDLY LINKS ---- */
@media (max-width: 768px) {
    a, button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Footer links don't need to be that big */
    footer a {
        min-height: unset;
        min-width: unset;
        display: inline-block;
        padding: 4px 0;
    }
}
