/**
 * Responsive CSS Enhancements
 * Cellsoft Technologies Website
 * Improves mobile, tablet, and desktop responsiveness
 */

/* ============================================
   CSS Variables for Responsive Design
   ============================================ */
:root {
    --nav-height: 70px;
    --nav-height-mobile: 60px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --mobile-menu-width: 320px;
    --mobile-menu-bg: #ffffff;
    --mobile-menu-text: #104253;
    --mobile-menu-accent: #2AA4C7;
}

/* ============================================
   Global Responsive Base Styles
   ============================================ */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
}

body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    position: relative;
}

/* ============================================
   Hide internal div scrollbars on mobile
   Only main page should scroll
   ============================================ */
@media (max-width: 991px) {
    /* Hide scrollbars on all elements except html/body */
    main, main *,
    section, section *,
    .container, .container *,
    .card, .card *,
    [class*="card"], [class*="card"] *,
    .row, .row *,
    div:not(body):not(html) {
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }
    
    main::-webkit-scrollbar,
    main *::-webkit-scrollbar,
    section::-webkit-scrollbar,
    section *::-webkit-scrollbar,
    .container::-webkit-scrollbar,
    .container *::-webkit-scrollbar,
    .card::-webkit-scrollbar,
    .card *::-webkit-scrollbar,
    [class*="card"]::-webkit-scrollbar,
    [class*="card"] *::-webkit-scrollbar,
    div:not(body):not(html)::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
}

/* Prevent any element from causing horizontal overflow */
*, *::before, *::after {
    max-width: 100vw;
}

img {
    max-width: 100%;
    height: auto;
}

/* Ensure main wrapper doesn't overflow */
#wrapper,
.wrapper,
main,
.main-content {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Fixed elements that might cause overflow */
.hero-section {
    overflow: hidden !important;
    max-width: 100vw !important;
}

.hero-bg-shapes {
    overflow: hidden !important;
    max-width: 100% !important;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.hero-bg-shapes .shape {
    max-width: 100vw;
}

/* Floating cards - hide on mobile to prevent overflow */
@media (max-width: 991px) {
    .floating-card {
        display: none !important;
    }
    
    .hero-bg-shapes .shape-1,
    .hero-bg-shapes .shape-2 {
        display: none;
    }

    /* AOS animations can cause horizontal overflow before completing */
    [data-aos] {
        overflow: hidden;
    }

    [data-aos="fade-left"],
    [data-aos="fade-right"],
    [data-aos="slide-left"],
    [data-aos="slide-right"] {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ============================================
   Enhanced Mobile Menu Styles
   ============================================ */

/* Animated Hamburger Button */
.mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    position: relative;
}

.hamburger-box {
    width: 24px;
    height: 18px;
    display: inline-block;
    position: relative;
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    width: 24px;
    height: 3px;
    background-color: #2AA4C7;
    border-radius: 3px;
    position: absolute;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                opacity 0.15s ease,
                background-color 0.3s ease;
}

.hamburger-inner {
    top: 50%;
    transform: translateY(-50%);
}

.hamburger-inner::before {
    content: '';
    top: -8px;
}

.hamburger-inner::after {
    content: '';
    bottom: -8px;
    top: auto;
}

/* Hamburger to X animation */
.mobile-menu-toggle.active .hamburger-inner {
    transform: translateY(-50%) rotate(45deg);
    background-color: #104253;
}

.mobile-menu-toggle.active .hamburger-inner::before {
    top: 0;
    transform: rotate(90deg);
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-inner::after {
    bottom: 0;
    transform: rotate(90deg);
    opacity: 0;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16, 66, 83, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 998;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Slide-in Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--mobile-menu-width);
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    background: var(--mobile-menu-bg);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mobile-menu.active {
    transform: translateX(0);
}

/* Mobile Menu Header */
.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.mobile-menu-logo {
    height: 36px;
    object-fit: contain;
}

.mobile-menu-close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #104253;
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(16, 66, 83, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-close .close-icon {
    display: block;
    margin-top: -2px;
}

.mobile-menu-close:hover,
.mobile-menu-close:active {
    background: #e53e3e;
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.4);
}

/* Mobile Navigation */
.mobile-menu-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    color: var(--mobile-menu-text);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.mobile-nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--mobile-menu-accent);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    background: rgba(42, 164, 199, 0.08);
    color: var(--mobile-menu-accent);
}

.mobile-nav-item:hover::before,
.mobile-nav-item.active::before {
    transform: scaleY(1);
}

.mobile-nav-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(42, 164, 199, 0.1) 0%, rgba(42, 164, 199, 0.05) 100%);
    border-radius: 12px;
    margin-right: 16px;
    font-size: 18px;
    color: var(--mobile-menu-accent);
    transition: all 0.2s ease;
}

.mobile-nav-item:hover .mobile-nav-icon,
.mobile-nav-item.active .mobile-nav-icon {
    background: var(--mobile-menu-accent);
    color: #fff;
    transform: scale(1.05);
}

.mobile-nav-text {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
}

.mobile-nav-arrow {
    font-size: 12px;
    color: #a0aec0;
    transition: transform 0.2s ease;
}

.mobile-nav-item:hover .mobile-nav-arrow {
    transform: translateX(4px);
    color: var(--mobile-menu-accent);
}

/* Mobile Menu CTA */
.mobile-menu-cta {
    padding: 20px 24px;
    flex-shrink: 0;
}

.mobile-menu-cta .btn {
    padding: 14px 24px;
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 4px 15px rgba(42, 164, 199, 0.3);
}

/* Mobile Menu Footer */
.mobile-menu-footer {
    padding: 20px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.mobile-menu-contact {
    margin-bottom: 16px;
}

.mobile-contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.mobile-contact-item:hover {
    color: var(--mobile-menu-accent);
}

.mobile-contact-item i {
    width: 20px;
    color: var(--mobile-menu-accent);
}

/* Mobile Social Links */
.mobile-menu-social {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.mobile-menu-social .social-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 50%;
    color: #64748b;
    font-size: 16px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.mobile-menu-social .social-icon:hover {
    background: var(--mobile-menu-accent);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(42, 164, 199, 0.3);
}

.mobile-menu-copyright {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
}

/* Hide mobile menu on desktop */
@media (min-width: 992px) {
    .mobile-menu-toggle,
    .mobile-menu,
    .mobile-menu-overlay {
        display: none !important;
    }
}

/* Mobile menu responsive adjustments */
@media (max-width: 400px) {
    .mobile-menu {
        width: 100vw;
        max-width: 100vw;
    }
    
    .mobile-nav-item {
        padding: 14px 20px;
    }
    
    .mobile-nav-icon {
        width: 40px;
        height: 40px;
        margin-right: 12px;
    }
    
    .mobile-nav-text {
        font-size: 14px;
    }
}

/* Safe area for iOS devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-menu-footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* ============================================
   Navigation Responsive Improvements
   ============================================ */

/* Base nav spacing */
.navbar {
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.navbar .container {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

/* Logo responsiveness */
.navbar .logo {
    height: 45px;
    max-width: 150px;
    object-fit: contain;
    transition: all 0.3s ease;
}

/* Navbar brand - don't let it grow too much */
.navbar .navbar-brand {
    flex-shrink: 0;
    margin-right: auto;
}

/* Nav links base */
.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    position: relative;
}

/* Active/hover underline effect */
.navbar-nav .nav-link:not(.btn)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: #2AA4C7;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.navbar-nav .nav-link:not(.btn):hover::after,
.navbar-nav .nav-link:not(.btn).active::after {
    width: 70%;
}

/* Contact button */
.navbar .btn-outline-primary {
    padding: 0.5rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

/* Mobile menu toggle - CRITICAL: Always visible on mobile */
.navbar-toggler {
    padding: 0.5rem 0.75rem;
    border: none !important;
    background: transparent;
    outline: none !important;
    box-shadow: none !important;
    flex-shrink: 0;
    order: 2;
    margin-left: auto;
    display: none; /* Hidden on desktop by Bootstrap */
}

.navbar-toggler:focus {
    box-shadow: none !important;
}

.navbar-toggler .fa-bars {
    font-size: 1.5rem;
    color: #2AA4C7;
}

/* Show toggler below lg breakpoint */
@media (max-width: 991.98px) {
    .navbar-toggler {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* CRITICAL FIX: Ensure navbar container doesn't overflow */
    #navbar .container,
    .navbar > .container {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Logo should not push toggler out */
    #navbar .navbar-brand,
    .navbar .navbar-brand {
        flex: 0 0 auto !important;
        max-width: 60% !important;
        overflow: hidden !important;
    }

    #navbar .navbar-brand .logo,
    .navbar .navbar-brand .logo {
        max-width: 140px !important;
        height: 40px !important;
        object-fit: contain !important;
    }

    /* Toggler must be visible */
    #navbar .navbar-toggler,
    .navbar .navbar-toggler {
        display: flex !important;
        flex-shrink: 0 !important;
        position: relative !important;
        z-index: 1001 !important;
        margin-left: auto !important;
        padding: 8px 12px !important;
    }

    /* Collapse should not interfere when closed */
    #navbar .navbar-collapse:not(.show),
    .navbar .navbar-collapse:not(.show) {
        display: none !important;
    }

    #navbar .navbar-collapse.show,
    .navbar .navbar-collapse.show,
    .navbar .navbar-collapse.collapsing {
        display: block !important;
    }
}

/* ============================================
   Tablet Breakpoint (max-width: 991px)
   ============================================ */
@media (max-width: 991px) {
    /* CRITICAL: Prevent horizontal overflow */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    /* Fix Bootstrap row negative margins causing overflow */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .row > [class*='col-'] {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Container must not overflow */
    .container,
    .container-fluid {
        max-width: 100% !important;
        overflow-x: hidden !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Navigation tablet - fix toggler visibility */
    .navbar {
        padding: 0.5rem 1rem;
        width: 100% !important;
        max-width: 100vw !important;
    }

    .navbar .container {
        flex-wrap: nowrap;
    }

    .navbar .logo {
        height: 40px;
        max-width: 140px;
    }

    .navbar .navbar-brand {
        flex: 0 1 auto;
        max-width: 50%;
    }

    /* Ensure toggler is always visible */
    .navbar-toggler {
        display: flex !important;
        flex-shrink: 0;
        z-index: 1001;
    }

    /* Mobile menu expansion */
    .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 16px 16px;
        padding: 1rem;
        z-index: 1000;
        max-height: 80vh;
        overflow-y: auto;
    }

    .navbar-nav {
        flex-direction: column;
        width: 100%;
    }

    .navbar-nav .nav-item {
        width: 100%;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .navbar-nav .nav-item:last-child {
        border-bottom: none;
    }

    .navbar-nav .nav-link {
        padding: 1rem 1.25rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 1rem;
    }

    .navbar-nav .nav-link:not(.btn)::after {
        display: none;
    }

    .navbar-nav .nav-link:hover {
        background: rgba(42, 164, 199, 0.08);
        border-radius: 8px;
    }

    /* Mobile contact button */
    .navbar .btn-outline-primary {
        width: 100%;
        margin: 1rem 0 0 0 !important;
        padding: 0.875rem;
        text-align: center;
        justify-content: center;
    }

    /* Hero sections */
    .main-section {
        margin-top: var(--nav-height-mobile);
        padding-top: 1rem;
    }

    /* General spacing adjustments */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    section {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Typography scaling */
    h1, .h1 {
        font-size: 2rem;
    }

    h2, .h2 {
        font-size: 1.75rem;
    }

    h3, .h3 {
        font-size: 1.35rem;
    }

    h4, .h4 {
        font-size: 1.15rem;
    }

    /* Intro heading adjustments */
    .intro-heading {
        font-size: 2rem;
        margin-top: 2rem;
    }

    /* App sections */
    .app-details-section {
        margin-top: 80px;
    }

    /* Columns */
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .row > [class*='col-'] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Cards */
    .card {
        margin-bottom: 1rem;
    }

    /* Sidebar on tablet becomes horizontal scroll */
    .sticky-sidebar {
        position: relative;
        top: 0;
    }

    .other-apps-cont {
        height: auto;
        overflow-y: visible;
    }

    /* Grid adjustments */
    .download-options {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Info grid */
    .info-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   Mobile Breakpoint (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    /* CRITICAL: Prevent horizontal overflow */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    /* Fix Bootstrap row negative margins */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Base spacing */
    :root {
        --spacing-sm: 0.75rem;
        --spacing-md: 1rem;
        --spacing-lg: 1.5rem;
    }

    /* Navigation mobile */
    .navbar {
        padding: 0.375rem 0.75rem;
        width: 100% !important;
    }

    .navbar .logo {
        height: 38px;
        max-width: 120px;
    }

    /* Typography mobile - smaller sizes */
    body {
        font-size: 15px;
    }

    h1, .h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    h2, .h2 {
        font-size: 1.5rem;
    }

    h3, .h3 {
        font-size: 1.25rem;
    }

    h4, .h4 {
        font-size: 1.1rem;
    }

    p {
        font-size: 1rem;
        line-height: 1.6;
    }

    /* Container padding */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Intro section mobile */
    .intro-heading {
        font-size: 1.5rem;
        text-align: center;
        margin-top: 1rem;
        line-height: 1.3;
    }

    .intro_p {
        font-size: 0.95rem;
        text-align: center;
    }

    /* App details section */
    .app-details-section {
        margin-top: 70px;
    }

    /* Why us section */
    .why-us-title {
        font-size: 1.5rem;
        text-align: center;
    }

    /* Grid adjustments - single column */
    .download-options {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .docs-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Feature chips mobile */
    .feature-chips {
        justify-content: center;
    }

    .feature-chip {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }

    /* Buttons mobile */
    .btn {
        padding: 0.625rem 1.25rem;
    }

    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .start-now-btn {
        padding: 0.75rem 2rem;
        width: 100%;
        max-width: 300px;
        display: block;
        margin: 0 auto;
        text-align: center;
    }

    .contact-us-btn {
        padding: 0.75rem 1.5rem;
        width: 100%;
        text-align: center;
    }

    /* Images mobile */
    .intro-img,
    .overview-img,
    .pos-img,
    .dash-img {
        height: auto;
        max-height: 250px;
        width: 100%;
        object-fit: contain;
        float: none;
        display: block;
        margin: 1.5rem auto;
    }

    /* Footer mobile */
    .footer {
        text-align: center;
    }

    .footer-ul {
        text-align: center;
        padding-left: 0;
        margin-left: 0;
    }

    .p-footer {
        text-align: center;
    }

    /* Product images mobile */
    .product-img {
        max-height: 180px;
        margin: 0 auto;
        display: block;
    }

    /* Store cards mobile */
    .app-card,
    .side-card {
        padding: 0.75rem;
    }

    .card-top-img {
        height: 70px;
    }

    /* Contact section mobile */
    .contact-item {
        padding: 1rem 0.5rem;
    }

    .contacts-section {
        margin-top: 1.5rem;
    }

    /* Steps/process sections mobile */
    .steps-section {
        padding: 1rem;
    }

    /* Get in touch section mobile */
    .get-in-touch-section {
        padding: 1.5rem 1rem;
        text-align: center;
    }

    .get-in-touch-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .btn-get-in-touch {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
        display: block;
    }

    /* Sidebar mobile */
    .sidebar-section {
        margin-bottom: 1.5rem;
    }

    /* Similar apps horizontal scroll on mobile */
    .similar-apps-list {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 0.75rem;
        padding-bottom: 0.5rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .similar-app-card {
        flex: 0 0 auto;
        min-width: 200px;
        scroll-snap-align: start;
    }

    /* Quick links mobile */
    .quick-links {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .quick-links a {
        font-size: 0.8rem;
        padding: 0.75rem 0.5rem;
        text-align: center;
        justify-content: center;
    }

    /* Ratings mobile */
    .ratings-overview {
        flex-direction: column;
        text-align: center;
    }

    .rating-big {
        margin-bottom: 1.5rem;
    }

    .rating-big-number {
        font-size: 2.5rem;
    }

    .rating-bars {
        width: 100%;
    }

    /* Table responsive */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Module titles */
    .module_title {
        font-size: 1.25rem;
        text-align: center;
    }

    /* Padding utilities for mobile */
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .py-4 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    .px-5 {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    .mt-5 {
        margin-top: 2rem !important;
    }

    .mb-5 {
        margin-bottom: 2rem !important;
    }

    /* Hide on mobile utility */
    .hide-mobile {
        display: none !important;
    }

    /* Show on mobile utility */
    .show-mobile {
        display: block !important;
    }

    /* Text center on mobile */
    .text-center-mobile {
        text-align: center !important;
    }

    /* Reverse order on mobile for better visual hierarchy */
    .order-first-mobile {
        order: -1;
    }

    .order-last-mobile {
        order: 99;
    }
}

/* ============================================
   Small Mobile Breakpoint (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    /* Very small screen navbar adjustments */
    #navbar .container,
    .navbar > .container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .navbar .logo,
    #navbar .navbar-brand .logo {
        height: 32px !important;
        max-width: 100px !important;
    }

    .navbar .navbar-brand {
        max-width: 55% !important;
    }

    .navbar-toggler {
        padding: 6px 10px !important;
    }

    .navbar-toggler .fa-bars {
        font-size: 1.25rem;
    }

    h1, .h1 {
        font-size: 1.5rem;
    }

    h2, .h2 {
        font-size: 1.3rem;
    }

    h3, .h3 {
        font-size: 1.15rem;
    }

    .intro-heading {
        font-size: 1.35rem;
    }

    /* Container even tighter */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Info grid single column on very small screens */
    .info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .info-item {
        padding: 0.75rem;
    }

    /* Cards compact */
    .card-top-img {
        height: 60px;
    }

    /* Feature chips wrap nicely */
    .feature-chips {
        gap: 0.5rem;
    }

    .feature-chip {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    /* Buttons full width */
    .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* Download cards compact */
    .download-card {
        padding: 1rem;
    }

    .download-card i {
        font-size: 1.5rem;
    }

    /* Quick links single column */
    .quick-links {
        grid-template-columns: 1fr;
    }

    /* App meta items */
    .app-meta-item {
        min-width: 50px;
    }

    .app-meta-value {
        font-size: 0.85rem;
    }

    .app-meta-label {
        font-size: 0.65rem;
    }

    /* Appstore images */
    .appstore,
    .playstore {
        height: 40px;
    }

    /* Footer compact */
    .footer-bottom-image {
        width: 120px;
        height: auto;
    }
}

/* ============================================
   Desktop Enhancements (min-width: 992px)
   ============================================ */
@media (min-width: 992px) {
    /* Desktop nav spacing */
    .navbar-nav .nav-link {
        padding: 1rem 1.25rem;
    }

    /* Desktop hover effects */
    .navbar-nav .nav-link:hover {
        transform: translateY(-2px);
    }

    /* Hide mobile utilities */
    .hide-desktop {
        display: none !important;
    }

    .show-desktop {
        display: block !important;
    }

    /* Sticky sidebar desktop */
    .sticky-sidebar {
        position: sticky;
        top: 100px;
    }

    /* Grid optimal for desktop */
    .download-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .info-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   Large Desktop (min-width: 1200px)
   ============================================ */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }

    .navbar .logo {
        height: 50px;
    }

    h1, .h1 {
        font-size: 2.5rem;
    }

    .intro-heading {
        font-size: 2.75rem;
    }
}

/* ============================================
   Extra Large Desktop (min-width: 1400px)
   ============================================ */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* ============================================
   Height-based Adjustments (Landscape Mobile)
   ============================================ */
@media (max-height: 600px) and (orientation: landscape) {
    .navbar {
        padding: 0.25rem 1rem;
    }

    .navbar .logo {
        height: 30px;
    }

    .main-section {
        margin-top: 50px;
    }

    .app-details-section {
        margin-top: 55px;
    }
}

/* ============================================
   Touch Device Optimizations
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .navbar-nav .nav-link {
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    .btn {
        min-height: 48px;
    }

    /* Remove hover effects on touch */
    .navbar-nav .nav-link:hover {
        transform: none;
    }

    .card:hover,
    .app-card:hover,
    .download-card:hover {
        transform: none;
    }

    /* Active state for touch */
    .btn:active,
    .card:active,
    .nav-link:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    /* Better scrolling */
    .screenshots-scroll,
    .similar-apps-list {
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .navbar,
    .footer,
    .sidebar-section,
    .btn,
    .screenshots-section {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    h1, .h1 { font-size: 18pt; }
    h2, .h2 { font-size: 16pt; }
    h3, .h3 { font-size: 14pt; }

    a {
        text-decoration: underline;
        color: #000;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 10pt;
    }
}

/* ============================================
   Store Page Responsive Enhancements
   ============================================ */
@media (max-width: 991px) {
    /* Hero section tablet */
    .hero-section {
        padding: 100px 0 60px !important;
    }

    .hero-section .hero-title {
        font-size: 2rem;
    }

    .hero-section img {
        max-height: 300px !important;
    }

    /* Category filters scroll on tablet */
    .category-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
    }

    .category-filters::-webkit-scrollbar {
        height: 4px;
    }

    .btn-filter {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    /* Hero mobile */
    .hero-section {
        padding: 90px 0 40px !important;
        text-align: center;
    }

    .hero-section .hero-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .hero-section .hero-text {
        font-size: 0.9rem;
    }

    .hero-section .d-flex {
        justify-content: center;
    }

    .hero-section .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }

    .hero-section img {
        max-height: 220px !important;
        margin-top: 1.5rem;
    }

    /* Stats mobile */
    .hero-section .row.mt-5 {
        text-align: center;
        margin-top: 2rem !important;
    }

    .hero-section .row.mt-5 h3 {
        font-size: 1.5rem;
    }

    /* Search filter mobile */
    .search-filter-container {
        border-radius: 12px !important;
        padding: 0.5rem !important;
    }

    .search-filter-container input {
        font-size: 0.85rem;
    }

    /* Category filters horizontal scroll */
    .category-filters {
        justify-content: flex-start;
        padding: 0 1rem 1rem;
        margin: 0 -1rem;
        gap: 8px;
    }

    .btn-filter {
        padding: 8px 14px;
        font-size: 0.75rem;
    }

    /* Store cards mobile */
    .store-card {
        border-radius: 16px;
    }

    .app-icon-container {
        width: 60px;
        height: 60px;
        border-radius: 14px;
    }

    .store-card .app-name {
        font-size: 0.9rem;
    }

    .store-card .app-desc {
        font-size: 0.75rem;
    }

    .store-card .badge {
        font-size: 0.6rem;
        padding: 4px 8px;
    }

    .store-card .card-footer .btn {
        font-size: 0.75rem;
        padding: 8px 12px;
    }

    .platform-icons i {
        font-size: 0.8rem;
        width: 20px;
        height: 20px;
    }

    /* Section titles mobile */
    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 0.9rem;
    }

    /* Why choose section mobile */
    .feature-icon-wrapper {
        width: 60px;
        height: 60px;
    }

    .feature-icon-wrapper i {
        font-size: 1.5rem;
    }

    /* CTA section mobile */
    .cta-section-modern {
        padding: 3rem 1rem;
    }

    .cta-title {
        font-size: 1.5rem;
    }

    .cta-text {
        font-size: 0.9rem;
    }

    .cta-section-modern .btn {
        width: 100%;
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .hero-section .hero-title {
        font-size: 1.3rem;
    }

    .hero-section .btn-lg {
        width: 100%;
    }

    .hero-section .row.mt-5 .col-4 {
        padding: 0 0.25rem;
    }

    .hero-section .row.mt-5 h3 {
        font-size: 1.25rem;
    }

    .hero-section .row.mt-5 small {
        font-size: 0.65rem;
    }

    .btn-filter {
        padding: 6px 10px;
        font-size: 0.7rem;
    }

    .app-icon-container {
        width: 52px;
        height: 52px;
    }

    .store-card .card-body {
        padding: 1rem !important;
    }
}

/* ============================================
   Contact Page Responsive Enhancements
   ============================================ */
@media (max-width: 768px) {
    .callback-form {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .contact-item {
        padding: 1rem;
        text-align: center;
    }

    .contact-item h4 {
        font-size: 1rem;
    }

    .contact-icon {
        font-size: 2rem;
    }

    .contacts-section .row {
        gap: 1rem;
    }
}

/* ============================================
   Legal Pages Responsive Enhancements
   ============================================ */
@media (max-width: 768px) {
    .policy-hero-modern {
        padding: 80px 0 40px;
    }

    .policy-hero-modern h1 {
        font-size: 1.5rem;
    }

    .policy-hero-modern .lead {
        font-size: 0.9rem;
    }

    .policy-content {
        padding: 1.5rem;
    }

    .policy-content h2 {
        font-size: 1.25rem;
    }

    .policy-content h3 {
        font-size: 1.1rem;
    }

    .policy-section {
        padding: 1.5rem 0;
    }
}

/* ============================================
   Animation Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode support
    :root {
        --app-bg: #1a1a2e;
        --app-card: #16213e;
        --app-border: rgba(255,255,255,0.1);
    }
    */
}

/* ============================================
   CRITICAL: Final Horizontal Overflow Fix
   This MUST be at the end to override any other styles
   ============================================ */
@media screen and (max-width: 1024px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
        position: relative !important;
    }

    /* Prevent ANY element from extending beyond viewport */
    body > *,
    main,
    main > *,
    section,
    .container,
    .container-fluid,
    .row,
    header,
    footer,
    nav,
    .navbar,
    .globe-container {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* Globe container specific overflow fix */
    .globe-container {
        overflow: hidden !important;
    }

    /* Fix Bootstrap negative margins causing overflow */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }

    [class*="col-"] {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Disable AOS fade-left/right which cause horizontal overflow */
    [data-aos="fade-left"],
    [data-aos="fade-right"],
    [data-aos="slide-left"],
    [data-aos="slide-right"],
    [data-aos="zoom-in-left"],
    [data-aos="zoom-in-right"],
    [data-aos="flip-left"],
    [data-aos="flip-right"] {
        opacity: 1 !important;
        transform: translateZ(0) !important;
    }

    /* Hide decorative elements that may overflow */
    .hero-bg-shapes,
    .floating-card,
    .shape {
        display: none !important;
    }

    /* Ensure navbar container works correctly */
    #navbar,
    #navbar .container,
    .navbar .container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}
