/*
 * ================================================
 *  PLACEEPRO — MOBILE RESPONSIVE STYLESHEET
 *  Pure Phone Optimization (320px - 768px)
 *  Strictly eliminating congestion & overlap
 * ================================================
 */

/* ─── Base Reset ─── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* ════════════════════════════════════════════════
   TABLET PRE-MOBILE (769px - 1024px)
   ════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .navbar-wrapper {
        margin: 16px 20px 0 20px;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .insights-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* ════════════════════════════════════════════════
   PHONES & MOBILE DEVICES (STRICT ≤ 768px)
   ════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── 1. GLOBAL TYPOGRAPHY ── */
    h1 {
        font-size: 24px !important;
        letter-spacing: -0.5px !important;
    }

    h2 {
        font-size: 20px !important;
    }

    p,
    span,
    td,
    th {
        font-size: 14px !important;
    }

    /* ── 2. NAVBAR: REDUCED CLUTTER ── */
    .navbar-wrapper {
        margin: 0 !important;
        padding: 0 12px !important;
        height: 50px !important;
        /* Compact high-up feel */
        width: 100vw !important;
        max-width: 100% !important;
        background: rgba(10, 10, 10, 0.99);
        border-bottom: 1px solid rgba(212, 175, 55, 0.2);
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        z-index: 10000;
        display: flex !important;
        flex-direction: row !important;
        /* Standard row + Order control */
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        pointer-events: auto !important;
    }

    /* Move Navigation Group to FAR LEFT */
    .navbar-right-group {
        order: -1 !important;
        width: auto !important;
        display: flex !important;
        flex-direction: row-reverse !important;
        /* Visual: [Hamburger] [Profile] */
        align-items: center !important;
        gap: 12px !important;
        margin: 0 !important;
    }

    /* Move Branding to FAR RIGHT */
    .navbar-wrapper>a[style*="text-decoration: none"] {
        order: 10 !important;
        display: block !important;
        margin: 0 !important;
    }

    .logo {
        justify-content: flex-end !important;
        text-align: right !important;
    }

    .logo-tagline {
        display: none !important;
    }

    .user-profile {
        display: flex !important;
        position: static !important;
        transform: scale(0.85);
        /* Smaller profile icon */
    }

    .profile-trigger {
        background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.05)) !important;
        border: 1px solid rgba(212, 175, 55, 0.3) !important;
        width: 34px !important;
        height: 34px !important;
        box-shadow: 0 0 10px rgba(212, 175, 55, 0.1) !important;
    }

    .user-icon {
        color: var(--primary) !important;
        width: 16px !important;
        height: 16px !important;
    }

    /* Small badge next to logo */
    #navCollegeDisplay {
        position: static !important;
        font-size: 8px !important;
        font-weight: 700 !important;
        padding: 2px 5px !important;
        margin: 0 !important;
        letter-spacing: 0.2px;
        background: rgba(212, 175, 55, 0.12);
        border: 1px solid rgba(212, 175, 55, 0.2);
        border-radius: 4px;
        color: var(--primary);
    }

    .place-text,
    .pro-text {
        font-size: 14px !important;
        line-height: 1 !important;
        letter-spacing: -0.3px !important;
    }

    .hamburger-container {
        transform: scale(0.6);
        /* Small signature size */
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Yellow/Gold Hamburger Lines */
    .line {
        stroke: #FFD700 !important;
        /* Vivid Gold/Yellow */
        stroke-width: 4.5 !important;
        /* Bold for small scale */
    }

    .dropdown-menu {
        left: 0 !important;
        right: auto !important;
        transform-origin: top left !important;
        top: 100% !important;
        margin-top: 5px !important;
    }

    /* ── 3. HERO CAROUSEL: ZERO CONGESTION ── */
    .hero-carousel {
        height: auto !important;
        aspect-ratio: 16/11;
        margin-top: 60px !important;
        border-radius: 12px !important;
        padding: 10px !important;
        overflow: hidden;
    }

    .carousel-inner {
        max-width: 100% !important;
    }

    .carousel-item {
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: center !important;
        text-align: center !important;
        padding: 5px 15px !important;
        gap: 15px !important;
    }

    .slide-content {
        align-items: center !important;
        text-align: center !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .slide-tag {
        font-size: 9px !important;
        padding: 3px 8px !important;
        margin: 0 !important;
    }

    .slide-title {
        font-size: 26px !important;
        letter-spacing: -1px !important;
        margin: 0 !important;
    }

    .slide-subtitle {
        font-size: 13px !important;
        line-height: 1.3 !important;
        max-width: 100% !important;
        margin: 0 !important;
        opacity: 0.7;
    }

    .slide-data-visual {
        align-items: center !important;
        width: 100% !important;
        margin-top: 5px !important;
    }

    /* ELIMINATE OVERLAPPING ICONS: Stacking instead of absolute overlay */
    .slide-logo-group {
        position: static !important;
        justify-content: center !important;
        gap: 12px !important;
        margin-bottom: 5px !important;
    }

    .slide-logo {
        height: 20px !important;
        opacity: 0.8 !important;
    }

    /* SCALE DOWN GIANT NUMBERS & PROTECT DOTS */
    .slide-value {
        font-size: 42px !important;
        letter-spacing: -1px !important;
        text-align: center !important;
        margin: 0 !important;
        padding-bottom: 5px;
        /* Protective buffer for indicators */
    }

    .slide-value .unit {
        font-size: 14px !important;
        opacity: 0.8;
    }

    .carousel-dots {
        bottom: 5px !important;
    }

    /* ── 4. DASHBOARD HEADER & SPACING ── */
    .dashboard-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
        /* Forces separation between title and dropdown */
        margin-top: 20px !important;
        padding: 0 15px !important;
    }

    .title-group {
        width: 100% !important;
        margin-bottom: 5px !important;
    }

    .batch-dropdown-container {
        width: 100% !important;
        margin: 0 !important;
    }

    .batch-select-input {
        width: 100% !important;
    }

    #dashboard {
        padding-top: 0 !important;
    }

    .stats-container {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding: 15px !important;
        margin: 20px 0 40px 0 !important;
    }

    .card {
        padding: 16px !important;
        border-radius: 14px !important;
        min-height: auto !important;
    }

    .card h3 {
        font-size: 10px !important;
        opacity: 0.8;
        margin-bottom: 4px;
    }

    .card .number {
        font-size: 28px !important;
        margin-bottom: 2px !important;
    }

    .card span {
        font-size: 11px !important;
        opacity: 0.6;
    }

    /* ── 5. TABLES: HORIZONTAL FLUIDITY ── */
    .recruitment-table-container,
    .table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px !important;
        margin: 15px 0;
    }

    table {
        min-width: 450px !important;
    }

    /* force scroll, disable squash */
    th,
    td {
        padding: 10px 12px !important;
        font-size: 13px !important;
    }

    /* ── 6. FORMS & BUTTONS: TAP-FRIENDLY ── */
    .top-controls {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 15px !important;
    }

    .control-group {
        width: 100% !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .top-controls input,
    .top-controls select,
    .primary-btn {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 16px !important;
        /* Prevents auto-zoom on iOS */
    }

    /* ── 7. SIDE DRAWER REDESIGN ── */
    .dynamic-island-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -280px !important;
        width: 280px !important;
        height: 100vh !important;
        
        /* GLASSMORPHIC BACKGROUND (SUBTLE) */
        background: rgba(20, 20, 20, 0.75) !important;
        backdrop-filter: blur(14px) saturate(120%);
        -webkit-backdrop-filter: blur(14px);
        
        z-index: 100001 !important;
        transition: left 0.4s cubic-bezier(0.19, 1, 0.22, 1);
        padding: 60px 20px !important;
        border-radius: 0 !important;
        
        /* SOFT GLOW (NOT HARSH) */
        box-shadow: 0 0 30px rgba(255, 180, 50, 0.1);
        border-right: 1px solid rgba(255, 200, 100, 0.15);
    }

    .dynamic-island-sidebar.mobile-active {
        left: 0 !important;
    }

    .dynamic-island-text {
        display: block !important;
        position: static !important;
        font-size: 14px;
        margin-bottom: 25px;
        color: var(--primary);
        letter-spacing: 2.5px;
        font-weight: 800;
        opacity: 1 !important;
        text-transform: uppercase;
        text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
    }

    .dynamic-icons {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .dynamic-item {
        width: 100% !important;
        height: 48px !important;
        justify-content: flex-start !important;
        padding: 0 20px !important;
        margin: 0 !important;
        background: rgba(255, 200, 100, 0.03);
        border-radius: 12px !important;
        border: 1px solid rgba(255, 200, 100, 0.05);
        color: rgba(255, 255, 255, 0.5) !important;
        transition: all 0.3s ease;
    }

    .dynamic-item:hover, .dynamic-item.active {
        color: #ffc85c !important;
        background: rgba(255, 200, 100, 0.1);
        border-color: rgba(255, 200, 100, 0.2);
    }

    .dynamic-item svg {
        width: 18px !important;
        height: 18px !important;
    }

    .dynamic-item.active::after {
        content: "";
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 4px;
        border-radius: 2px;
        background: #ffc85c;
        box-shadow: 0 0 8px #ffc85c;
        display: block !important;
    }

    /* ── 8. ANALYTICS & INSIGHTS GRID ── */
    .insights-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        /* Fixed: Force 1-column Insights (Image 1 fix) */
        gap: 20px !important;
        padding: 0 !important;
    }

    .analytics-grid,
    .charts-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 10px !important;
    }

    .insight-card {
        padding: 20px !important;
        width: 100% !important;
    }

    .placement-highlights {
        padding: 20px 15px !important;
        margin-top: 50px !important;
    }

    /* ── 9. MODALS & POPUPS ── */
    .glass-popup-content,
    .modal-content {
        width: 95vw !important;
        margin: 0 10px !important;
        padding: 20px 15px !important;
    }

    .popup-title {
        font-size: 18px !important;
    }

    /* ── 10. BACKGROUND OVERLAY (DRAWER) ── */
    .mobile-sidebar-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.7) !important;
        backdrop-filter: blur(5px) !important;
        z-index: 100000 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity 0.4s ease !important;
        display: block !important;
    }

    .mobile-sidebar-overlay.active {
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

/* PERFORMANCE: NO BLUR/SHADOW ON TINY SCREENS */
@media (max-width: 480px) {

    .glass-popup-content,
    .card,
    .navbar-wrapper {
        backdrop-filter: none !important;
    }

    .slide-title {
        font-size: 22px !important;
    }

    .slide-value {
        font-size: 38px !important;
    }

    .card .number {
        font-size: 24px !important;
    }
}

/* ════════════════════════════════════════════════
   FINAL MOBILE UI POLISH (STRICTLY MOBILE ONLY)
   ════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* FIX 1 — HERO TEXT POSITIONING */
    .hero,
    .highlight-section {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        padding-top: 8px !important;
        padding-bottom: 30px !important;
        gap: 22px !important;
    }

    .hero-title {
        font-size: 20px !important;
        margin-top: 8px !important;
        letter-spacing: 0.5px !important;
    }

    .hero-subtext {
        font-size: 13px !important;
        margin-top: 4px !important;
        line-height: 1.5 !important;
        opacity: 0.8 !important;
    }

    .hero-price {
        font-size: 36px !important;
        font-weight: 800 !important;
        margin-top: 18px !important;
        color: var(--primary) !important;
    }

    /* FIX 2 — SEPARATE SLIDER FROM TEXT */
    .hero-slider,
    .progress-bar,
    .dots,
    .slider-container {
        margin-top: 30px !important;
        margin-bottom: 10px !important;
        display: flex !important;
        justify-content: center !important;
    }

    /* FIX 3 — HEADER PERFECT ALIGNMENT */
    .header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 16px !important;
    }

    .header-right {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .menu-icon,
    .profile-icon {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* FIX 4 — PREVENT ANY OVERFLOW */
    body {
        overflow-x: hidden !important;
    }

    /* FIX 5 — IMPROVE SECTION SPACING */
    .section,
    .overview-section {
        margin-top: 24px !important;
    }

    /* FIX 6 — TEXT BLOCK BREATHING */
    h1,
    h2,
    h3 {
        line-height: 1.3 !important;
    }
}