/* ============================================
   CollegeVaani Responsive Fixes
   Complete Mobile-First UI/UX Optimization
   ============================================ */

/* ===========================================
   GLOBAL MOBILE FIXES
   =========================================== */

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Better box sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ===========================================
   HEADER & NAVIGATION FIXES
   =========================================== */

@media (max-width: 991px) {
    /* Hide top header bar on mobile - save space */
    .header-top {
        display: none !important;
    }
    
    /* Main navigation fixes */
    .main-navigation {
        padding: 8px 0;
        position: sticky;
        top: 0;
        z-index: 1000;
        background: #fff;
    }
    
    .main-navigation .navbar-brand img {
        max-height: 40px;
        width: auto;
    }
    
    /* Search button in navbar */
    .mobile-menu-right {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .mobile-menu-right .search-btn button {
        background: none;
        border: none;
        font-size: 20px;
        color: #26478e;
        padding: 8px;
    }
    
    /* Mobile menu dropdown */
    .navbar-collapse {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        padding: 20px;
        z-index: 999;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .navbar-collapse.show {
        transform: translateX(0);
    }
    
    .navbar-nav {
        flex-direction: column;
    }
    
    .navbar-nav .nav-link {
        padding: 15px 0;
        border-bottom: 1px solid #eee;
        font-size: 16px;
    }
    
    /* Mega menu mobile fixes */
    .mega-menu .dropdown-menu {
        position: static !important;
        width: 100% !important;
        border: none;
        box-shadow: none;
        padding: 0 15px;
    }
    
    .mega-content .row {
        flex-direction: column;
    }
    
    .mega-content .col-md-3,
    .mega-content .col-md-9 {
        width: 100%;
        border: none !important;
    }
}

/* ===========================================
   HERO BANNER FIXES
   =========================================== */

.hero-section {
    position: relative;
    margin-top: 0;
}

.hero-slider img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

@media (max-width: 768px) {
    .hero-section {
        margin-top: 0 !important;
    }
    
    .hero-slider img {
        min-height: 200px;
        max-height: 280px;
        object-fit: cover;
    }
    
    /* Hero search overlay - CRITICAL FIX */
    .hero-search-overlay {
        position: relative !important;
        bottom: auto !important;
        background: linear-gradient(135deg, #26478e 0%, #1a3366 100%);
        padding: 20px 15px !important;
        margin-top: -10px;
    }
    
    .hero-search-box {
        padding: 8px !important;
        border-radius: 30px !important;
    }
    
    .hero-search-box .form-control {
        font-size: 14px !important;
        padding: 10px 15px !important;
        min-height: 44px;
    }
    
    .hero-search-box .btn {
        padding: 10px 15px !important;
        font-size: 14px;
        min-height: 44px;
    }
    
    .hero-search-overlay p {
        font-size: 12px !important;
        margin-top: 10px !important;
    }
    
    .hero-search-overlay p a {
        color: #fff !important;
    }
}

/* ===========================================
   STATS/COUNTER SECTION FIXES  
   =========================================== */

@media (max-width: 768px) {
    .counter-area,
    .process-wrap {
        padding: 20px 10px !important;
        transform: none !important;
        margin-top: 0 !important;
    }
    
    .feature-item {
        text-align: center;
        padding: 15px 10px !important;
        margin-bottom: 10px;
    }
    
    .feature-item::before {
        display: none !important;
    }
    
    .feature-item .feature-icon {
        margin-bottom: 8px;
    }
    
    .feature-item .feature-icon i {
        font-size: 28px !important;
    }
    
    .feature-item h4 {
        font-size: 22px !important;
        margin-bottom: 2px;
    }
    
    .feature-item p {
        font-size: 12px !important;
        margin-bottom: 0;
    }
    
    /* 2x2 grid for stats on mobile */
    .process-wrap .row {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .process-wrap .row > div {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }
}

/* ===========================================
   COURSE SECTION FIXES
   =========================================== */

@media (max-width: 768px) {
    .course-area {
        padding: 30px 0 !important;
    }
    
    .course-area .section-title h2 {
        font-size: 24px !important;
        line-height: 1.3;
    }
    
    .course-area .section-title p {
        font-size: 14px !important;
    }
    
    /* Course tabs - horizontal scroll */
    .course-area .nav.nav-pills {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 10px;
        gap: 8px;
    }
    
    .course-area .nav.nav-pills::-webkit-scrollbar {
        display: none;
    }
    
    .course-area .nav-pills .nav-link {
        white-space: nowrap;
        font-size: 13px !important;
        padding: 10px 16px !important;
        margin-bottom: 0 !important;
        border-radius: 25px !important;
        flex-shrink: 0;
    }
    
    /* Course cards - 2 per row */
    .course-area .row {
        display: flex;
        flex-wrap: wrap;
        margin: 0 -5px;
    }
    
    .course-area .row > [class*="col-"] {
        padding: 5px;
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    /* Course card styling */
    .cv-course-card,
    .course-card {
        border-radius: 12px !important;
        overflow: hidden;
        height: 100%;
    }
    
    .cv-course-card .card-body,
    .course-card .card-body {
        padding: 12px !important;
    }
    
    .cv-course-card h5,
    .course-card h5,
    .course-card .card-title {
        font-size: 13px !important;
        line-height: 1.3;
        margin-bottom: 6px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .cv-course-card p,
    .course-card p {
        font-size: 11px !important;
        line-height: 1.4;
        margin-bottom: 8px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .course-card .badge,
    .cv-course-card .badge {
        font-size: 10px !important;
        padding: 4px 8px !important;
    }
}

/* ===========================================
   UNIVERSITY CARDS FIXES
   =========================================== */

@media (max-width: 768px) {
    /* University cards - full width on mobile */
    .cv-uni-card {
        margin-bottom: 15px;
    }
    
    .cv-uni-card__image {
        height: 140px;
        overflow: hidden;
    }
    
    .cv-uni-card__image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .cv-uni-card__body {
        padding: 12px !important;
    }
    
    .cv-uni-card__header {
        gap: 10px;
    }
    
    .cv-uni-card__logo {
        width: 45px !important;
        height: 45px !important;
        object-fit: contain;
        border-radius: 8px;
    }
    
    .cv-uni-card__name {
        font-size: 14px !important;
        line-height: 1.3;
    }
    
    .cv-uni-card__name a {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .cv-uni-card__location {
        font-size: 12px !important;
    }
    
    .cv-uni-card__stats {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    
    .cv-uni-card__cta {
        flex-direction: column;
        gap: 8px !important;
    }
    
    .cv-uni-card__cta .btn {
        width: 100%;
        font-size: 13px !important;
        padding: 10px !important;
    }
    
    /* Approval badges */
    .cv-uni-card__approvals {
        flex-wrap: wrap;
        gap: 4px !important;
    }
    
    .cv-uni-card__approval-badge {
        font-size: 10px !important;
        padding: 3px 8px !important;
    }
    
    /* Compare button */
    .cv-uni-card__compare {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
    
    /* Ribbon badge */
    .cv-uni-card__ribbon {
        font-size: 10px !important;
        padding: 4px 10px !important;
    }
}

/* ===========================================
   UNIVERSITY DETAILS PAGE FIXES
   =========================================== */

@media (max-width: 768px) {
    .cv-university-header {
        flex-direction: column !important;
        text-align: center;
    }
    
    .cv-university-logo {
        width: 80px !important;
        height: 80px !important;
        margin: 0 auto 15px;
    }
    
    .cv-university-title {
        font-size: 20px !important;
        line-height: 1.3;
    }
    
    .cv-university-meta {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .cv-trust-badges {
        justify-content: center;
    }
    
    .cv-quick-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .cv-stat-item {
        padding: 10px !important;
    }
    
    .cv-stat-item strong {
        font-size: 16px !important;
    }
    
    .cv-stat-item span {
        font-size: 11px !important;
    }
    
    /* Tab navigation on details page */
    .nav-tabs,
    .cv-tabs .nav {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .nav-tabs::-webkit-scrollbar,
    .cv-tabs .nav::-webkit-scrollbar {
        display: none;
    }
    
    .nav-tabs .nav-link,
    .cv-tabs .nav-link {
        white-space: nowrap;
        padding: 12px 16px !important;
        font-size: 13px !important;
        flex-shrink: 0;
    }
    
    /* CTA buttons row */
    .cv-header-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .cv-header-actions .btn {
        width: 100%;
    }
    
    /* University image on right */
    .cv-university-image-wrap {
        margin-top: 20px;
    }
    
    .cv-university-image {
        max-height: 200px;
        object-fit: cover;
        border-radius: 12px !important;
    }
}

/* ===========================================
   BLOG & CONTENT FIXES
   =========================================== */

@media (max-width: 768px) {
    .blog-card {
        margin-bottom: 20px;
    }
    
    .blog-card img {
        height: 180px;
        object-fit: cover;
    }
    
    .blog-card .card-body {
        padding: 15px;
    }
    
    .blog-card h5 {
        font-size: 16px !important;
        line-height: 1.4;
    }
    
    .blog-card p {
        font-size: 13px !important;
    }
}

/* ===========================================
   FORMS & MODALS FIXES
   =========================================== */

@media (max-width: 768px) {
    /* Lead form modal */
    .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
        height: 100%;
    }
    
    .modal-content {
        border-radius: 0 !important;
        height: 100%;
        border: none;
    }
    
    .modal-header {
        padding: 15px 20px;
        border-bottom: 1px solid #eee;
    }
    
    .modal-body {
        padding: 20px;
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 15px 20px;
        border-top: 1px solid #eee;
    }
    
    /* Form inputs */
    .form-control,
    .form-select {
        min-height: 48px;
        font-size: 16px !important; /* Prevent iOS zoom */
        padding: 12px 15px;
        border-radius: 8px;
    }
    
    .form-label {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    /* Search modal */
    #exampleModalSearch .modal-body {
        padding-top: 30px;
    }
    
    #exampleModalSearch .form-control {
        font-size: 18px;
        padding: 15px;
        border-radius: 10px;
    }
}

/* ===========================================
   FOOTER FIXES
   =========================================== */

@media (max-width: 768px) {
    footer {
        padding-bottom: 80px !important; /* Space for bottom nav */
    }
    
    .footer-widget {
        margin-bottom: 25px;
        text-align: center;
    }
    
    .footer-widget h4 {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    .footer-widget ul li {
        display: inline-block;
        margin: 5px 10px;
    }
    
    .footer-widget ul li a {
        font-size: 13px;
    }
    
    .footer-contact li {
        display: block !important;
        margin-bottom: 10px !important;
    }
    
    .footer-bottom {
        text-align: center;
        padding: 15px;
    }
    
    .footer-bottom p {
        font-size: 12px;
    }
}

/* ===========================================
   FLOATING ELEMENTS FIXES
   =========================================== */

@media (max-width: 768px) {
    /* WhatsApp floating button */
    .whatsapp-float,
    a[href*="wa.me"] {
        bottom: 90px !important; /* Above bottom nav */
        right: 15px !important;
    }
    
    .whatsapp-float img,
    a[href*="wa.me"] img {
        width: 50px !important;
        height: 50px !important;
    }
    
    /* Scroll to top button */
    #scroll-top {
        bottom: 150px !important;
        right: 15px;
        width: 40px;
        height: 40px;
    }
    
    /* Compare floating panel */
    .compare-panel {
        bottom: 75px !important;
        left: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
    }
}

/* ===========================================
   MOBILE BOTTOM NAVIGATION ENHANCEMENTS
   =========================================== */

@media (max-width: 768px) {
    .mobile-bottom-nav {
        padding: 6px 0 8px !important;
        box-shadow: 0 -2px 20px rgba(0,0,0,0.1);
    }
    
    .mobile-bottom-nav .nav-item {
        padding: 5px 8px;
    }
    
    .mobile-bottom-nav .nav-item i {
        font-size: 18px;
    }
    
    .mobile-bottom-nav .nav-item span {
        font-size: 10px;
        margin-top: 3px;
    }
    
    /* Central CTA button (Enquire) */
    .mobile-bottom-nav .nav-item.cta-btn {
        background: linear-gradient(135deg, #26478e 0%, #1a3366 100%);
        color: white !important;
        border-radius: 50%;
        width: 56px;
        height: 56px;
        margin-top: -20px;
        box-shadow: 0 4px 15px rgba(38, 71, 142, 0.4);
    }
    
    .mobile-bottom-nav .nav-item.cta-btn i {
        color: white;
        font-size: 22px;
    }
    
    .mobile-bottom-nav .nav-item.cta-btn span {
        color: white;
        font-size: 9px;
        font-weight: 600;
    }
}

/* ===========================================
   TYPOGRAPHY FIXES
   =========================================== */

@media (max-width: 768px) {
    h1 { font-size: 26px !important; line-height: 1.3; }
    h2 { font-size: 22px !important; line-height: 1.3; }
    h3 { font-size: 18px !important; line-height: 1.3; }
    h4 { font-size: 16px !important; line-height: 1.3; }
    h5 { font-size: 14px !important; line-height: 1.4; }
    h6 { font-size: 13px !important; line-height: 1.4; }
    
    p {
        font-size: 14px;
        line-height: 1.6;
    }
    
    .section-title {
        margin-bottom: 20px;
    }
    
    .section-title h2 {
        margin-bottom: 10px;
    }
    
    .section-title p {
        font-size: 14px;
    }
}

/* ===========================================
   SPACING & LAYOUT FIXES
   =========================================== */

@media (max-width: 768px) {
    /* Section padding */
    section,
    .py-5 {
        padding-top: 30px !important;
        padding-bottom: 30px !important;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Row gaps */
    .row.g-4 {
        --bs-gutter-x: 12px;
        --bs-gutter-y: 12px;
    }
    
    .row.g-3 {
        --bs-gutter-x: 10px;
        --bs-gutter-y: 10px;
    }
    
    /* Margin helpers */
    .mb-5 { margin-bottom: 1.5rem !important; }
    .mt-5 { margin-top: 1.5rem !important; }
    .my-5 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
    .py-5 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
}

/* ===========================================
   ACCESSIBILITY & TOUCH IMPROVEMENTS
   =========================================== */

@media (max-width: 768px) {
    /* Minimum touch target size */
    .btn,
    button,
    a.nav-link,
    .nav-item a,
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better tap highlighting */
    a, button, .btn {
        -webkit-tap-highlight-color: rgba(38, 71, 142, 0.2);
    }
    
    /* Focus states for accessibility */
    a:focus,
    button:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 2px solid #26478e;
        outline-offset: 2px;
    }
    
    /* Disable hover effects on touch */
    @media (hover: none) {
        .btn:hover,
        a:hover,
        .card:hover {
            transform: none !important;
            box-shadow: inherit !important;
        }
    }
}

/* ===========================================
   PERFORMANCE OPTIMIZATIONS
   =========================================== */

/* GPU acceleration for smooth scrolling */
.hero-slider,
.owl-carousel,
.mobile-bottom-nav,
.modal {
    will-change: transform;
    transform: translateZ(0);
}

/* Smooth transitions */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Image optimizations */
img {
    max-width: 100%;
    height: auto;
}

img[loading="lazy"] {
    background-color: #f5f5f5;
}

/* ===========================================
   PRINT STYLES (hide unnecessary elements)
   =========================================== */

@media print {
    .mobile-bottom-nav,
    .whatsapp-float,
    #scroll-top,
    .modal,
    .navbar-toggler,
    .compare-panel {
        display: none !important;
    }
}
