/* 
===============================================
    MOBILE RESPONSIVE STYLES — HOME PAGE
    Fixes applied based on mobile screenshot issues
===============================================
*/

/* ===================================================
   UNIVERSAL — prevent ALL horizontal overflow
   =================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* ===================================================
   TABLET  (≤ 1024px)
   =================================================== */
@media (max-width: 1024px) {
    body { overflow-x: hidden; }

    .container {
        padding-left: 15px;
        padding-right: 15px;
        width: 100%;
        max-width: 100%;
    }

    h1, .section-title { font-size: 2.2rem; }
    h2 { font-size: 1.8rem; }

    /* Top Bar */
    .top-bar-inner {
        flex-direction: column;
        gap: 8px;
        padding: 8px 15px;
        text-align: center;
    }
    .top-bar-left, .top-bar-right {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    /* Hero — prevent content overflow */
    .hero {
        height: calc(100vh - 80px);
        min-height: 480px;
    }

    /* Grid Resizing → 2 columns */
    .quick-cards,
    .academic-grid,
    .faculty-grid,
    .testi-grid,
    .footer-top {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .values-grid { grid-template-columns: repeat(2, 1fr); }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        grid-auto-rows: 200px;
    }

    /* About Section → single column */
    .about-inner {
        grid-template-columns: 1fr !important;
        gap: 30px;
    }
    .about-content, .about-visuals { width: 100%; }

    /* Notice & Events → single column */
    .ne-grid { grid-template-columns: 1fr; }

    /* About Actions */
    .about-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* ===================================================
   MOBILE (≤ 768px) — main fixes based on screenshots
   =================================================== */
@media (max-width: 768px) {

    /* --- Typography --- */
    h1, .section-title { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }

    /* ---- FIX 1: Hero slide content text is cut off ---- */
    .hero {
        height: 70vh;
        min-height: 400px;
        overflow: hidden;
    }
    .slide-content {
        /* Override the left:10% absolute position that causes right-side overflow */
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 20px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        text-align: center;
        /* clip anything that still spills */
        overflow: hidden;
    }
    .slide-content .badge { display: inline-block; }
    .slide-content h2 {
        font-size: 1.8rem !important;
        word-break: break-word;
        white-space: normal;
    }
    .slide-content p {
        font-size: 0.9rem !important;
        white-space: normal;
        word-break: break-word;
        margin-bottom: 20px;
    }
    /* Hero buttons — stack vertically and center */
    .hero-btns {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
    }
    .hero-btns .btn {
        width: 100% !important;
        max-width: 280px !important;
        display: flex !important;
        justify-content: center !important;
        margin: 0 auto !important;
    }
    /* Slider controls & dots — center on mobile */
    .slider-controls {
        right: 50%;
        bottom: 15px;
        transform: translateX(50%);
    }
    .slider-dots {
        left: 50%;
        bottom: 60px;
        transform: translateX(-50%);
    }

    /* ---- FIX 2: Notice ticker text overflows ---- */
    .notice-ticker-wrapper {
        overflow: hidden;
    }
    .ticker-container {
        flex-direction: column;
        text-align: center;
        gap: 6px;
        padding: 10px 15px;
    }
    .ticker-label { margin-bottom: 4px; }
    .ticker-content {
        overflow: hidden;
        width: 100%;
        max-width: 100%;
    }
    .ticker-view-all { margin-top: 4px; }

    /* ---- FIX 3: Quick Info — remove negative margin that overlaps ticker ---- */
    .quick-info {
        margin-top: 0 !important;  /* remove the -50px that pulls cards over ticker */
        padding-top: 30px;
    }
    .quick-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px;
    }

    /* ---- FIX 4: About section — fix broken image layout ---- */
    .about-inner {
        grid-template-columns: 1fr !important;
        gap: 30px;
    }
    .about-visuals {
        position: static !important;
        width: 100%;
    }
    /* Reset the entire img-grid to a normal stacked layout */
    .img-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        position: static !important;
        width: 100% !important;
        overflow: visible !important;
    }
    /* img-1: full width, normal height */
    .img-1 {
        position: static !important;
        width: 100% !important;
        height: 200px !important;
        object-fit: cover !important;
        transform: none !important;
        grid-column: auto !important;
        border-radius: 12px !important;
        display: block !important;
    }
    /* img-2: was position:absolute with right:-20px bottom:-80px — fully reset */
    .img-2 {
        position: static !important;
        width: 100% !important;
        height: 180px !important;
        object-fit: cover !important;
        transform: none !important;
        margin: 0 !important;
        right: auto !important;
        bottom: auto !important;
        border: none !important;
        border-radius: 12px !important;
        display: block !important;
    }
    /* experience-badge: was position:absolute left:-20px — pull into normal flow */
    .experience-badge {
        position: static !important;
        margin: 16px auto 0 !important;
        width: 110px !important;
        height: 110px !important;
        padding: 12px !important;
        left: auto !important;
        bottom: auto !important;
    }
    .experience-badge span { font-size: 1.6rem; }
    .experience-badge p    { font-size: 0.6rem; }
    /* Hide play button to avoid overlap on mobile */
    .play-video-btn { display: none !important; }

    /* Main Grids → single column */
    .academic-grid,
    .faculty-grid,
    .testi-grid,
    .contact-wrap,
    .footer-top {
        grid-template-columns: 1fr !important;
    }
    .values-grid { grid-template-columns: 1fr !important; }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: 1fr !important;
        grid-auto-rows: 200px;
    }
    .g-item.wide { grid-column: span 1 !important; }

    .gallery-filters {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    /* Notice & Events */
    .ne-grid { grid-template-columns: 1fr; gap: 30px; }

    /* CTA section */
    .cta-content h2 { font-size: 1.6rem; }
    .cta-content p  { font-size: 1rem; margin-bottom: 20px; }
    .cta-btns {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
    }
    .cta-btns .btn {
        width: 100% !important;
        max-width: 300px !important;
        display: flex !important;
        justify-content: center !important;
        margin: 0 auto !important;
    }

    /* Contact / Map */
    .contact-wrap  { flex-direction: column; }
    .contact-info-panel { padding: 30px 20px; }
    .map-container { min-height: 260px; height: 260px; }

    /* Event countdown */
    .countdown {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    /* Footer */
    .footer-top { grid-template-columns: repeat(2, 1fr) !important; gap: 30px; }
}

/* ===================================================
   SMALL MOBILE (≤ 480px)
   =================================================== */
@media (max-width: 480px) {

    .section-title { font-size: 1.5rem; }

    /* Hero */
    .hero { height: 65vh; min-height: 350px; }
    .slide-content h2 { font-size: 1.45rem !important; }
    .slide-content p  { font-size: 0.85rem !important; }

    /* Top Bar links */
    .top-bar-left a,
    .top-bar-left .emergency-banner { font-size: 0.75rem; }

    /* Quick info → single column */
    .quick-cards { grid-template-columns: 1fr !important; }

    /* Gallery */
    .gallery-grid { grid-template-columns: 1fr !important; grid-auto-rows: 180px; }
    .g-item.wide  { grid-column: span 1 !important; }

    /* Faculty */
    .faculty-grid { grid-template-columns: 1fr !important; }

    /* Footer → single column */
    .footer-top { grid-template-columns: 1fr !important; gap: 25px; }
    .footer-links li a { font-size: 0.9rem; }

    /* Newsletter */
    .newsletter-form { display: flex; flex-direction: column; gap: 10px; }
    .newsletter-form input, .newsletter-form button {
        width: 100%;
        border-radius: 8px;
    }

    /* App download */
    .app-btns { flex-direction: column; gap: 8px; }
    .app-btns a { width: 100%; text-align: center; }

    /* Testimonials */
    .testi-card { padding: 22px 15px; }

    /* Contact */
    .contact-info-panel { padding: 22px 12px; }

    /* Floating buttons */
    .theme-toggle   { bottom: 12px; left: 12px; width: 42px; height: 42px; }
    .back-to-top    { bottom: 65px; left: 12px; width: 42px; height: 42px; }
    .chatbot-toggle { bottom: 12px; right: 12px; width: 48px; height: 48px; }
    .chatbot-window { bottom: 70px; right: 12px; left: 12px; width: calc(100% - 24px); }
}

/* ===================================================
   Universal Table & Media Responsiveness
   =================================================== */
@media (max-width: 768px) {
    table, .data-table, .adm-table {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        width: 100% !important;
    }
    img, video {
        max-width: 100% !important;
        height: auto;
    }
    iframe {
        max-width: 100% !important;
    }
    .map-placeholder iframe,
    .map-container iframe {
        height: 260px !important;
    }
}

/* ===================================================
   Landscape on mobile
   =================================================== */
@media (max-width: 900px) and (orientation: landscape) {
    .hero { height: 90vh; min-height: 280px; }
    .slide-content { padding: 0 20px !important; }
    .slide-content h2 { font-size: 1.4rem !important; }
}
