/* ============================================
   MOBILE STYLES - Google Maps Inspired Layout
   mobile-styles.css
   ============================================ */

/* ============================================
   MOBILE CONTAINER - Base Layout
   ============================================ */

.mobile-container {
    display: none; /* Hidden by default, shown via JS on mobile */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden;
    background: #f8f9fa;
}

.desktop-container {
    display: block; /* Shown by default, hidden via JS on mobile */
}

/* ============================================
   MOBILE BETA BADGE - REMOVED
   ============================================ */

/* Removed for cleaner mobile UI
.mobile-beta-badge {
    position: fixed;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 10px;
    z-index: 2000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
*/

/* ============================================
   MOBILE SEARCH HEADER (Fixed Top)
   ============================================ */

.mobile-search-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mobile-search-bar {
    display: flex;
    gap: 8px;
    padding: 10px;
    align-items: center;
}

.mobile-search-bar input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    background: #f9fafb;
}

.mobile-search-bar input:focus {
    border-color: #3b82f6;
    background: white;
}

.mobile-search-bar input::placeholder {
    color: #9ca3af;
    font-size: 14px;
}

/* Send button - blue gradient */
#mobileSearchBtn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    transition: transform 0.2s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

#mobileSearchBtn:active {
    transform: scale(0.95);
}

/* Info button - white with border */
#mobileAboutBtn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    color: #374151;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

#mobileAboutBtn:active {
    transform: scale(0.95);
    background: #f9fafb;
}

/* ============================================
   AI RESPONSE LINE (Below Search)
   ============================================ */

.mobile-ai-response {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #eff6ff;
    border-top: 1px solid #dbeafe;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-avatar {
    font-size: 18px;
    flex-shrink: 0;
}

.ai-text {
    font-size: 14px;
    color: #1e40af;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   MAP CONTAINER (Full Screen)
   ============================================ */

.mobile-map-container {
    position: absolute;
    top: 68px; /* Below search bar */
    left: 0;
    right: 0;
    bottom: 60px; /* Above collapsed panel */
    width: 100%;
}

/* When AI response is shown */
.mobile-ai-response:not([style*="display: none"]) ~ .mobile-map-container {
    top: 108px; /* Account for AI response height */
}

#mobileMap {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* ============================================
   BOTTOM PANEL - Collapsed/Expanded States
   ============================================ */

.mobile-bottom-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
    z-index: 1500;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed state */
.mobile-bottom-panel.collapsed {
    transform: translateY(0);
}

/* Expanded state */
.mobile-bottom-panel.expanded {
    transform: translateY(calc(-50vh + 60px));
}

/* ============================================
   PANEL DRAG HANDLE
   ============================================ */

.panel-handle {
    padding: 8px 0;
    cursor: grab;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.panel-handle:active {
    cursor: grabbing;
}

.handle-bar {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 0 auto;
}

/* ============================================
   PANEL COLLAPSED STATE
   ============================================ */

.panel-collapsed {
    padding: 12px 20px;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.results-count {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}

/* Hide when expanded */
.mobile-bottom-panel.expanded .panel-collapsed {
    display: none;
}

/* ============================================
   PANEL EXPANDED STATE
   ============================================ */

.panel-expanded {
    display: none;
    height: 50vh;
    overflow: hidden;
    flex-direction: column;
}

.mobile-bottom-panel.expanded .panel-expanded {
    display: flex;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px; /* More compact */
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
    flex-shrink: 0;
}

.panel-header h2 {
    margin: 0;
    font-size: 15px; /* Slightly smaller */
    font-weight: 700;
    color: white;
}

.panel-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 18px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.panel-results {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px; /* More compact */
}

.panel-results::-webkit-scrollbar {
    display: none;
}

/* ============================================
   RESULT TILES (Mobile Optimized)
   ============================================ */

.mobile-result-tile {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px; /* More compact */
    margin-bottom: 8px; /* Less spacing */
    display: flex;
    gap: 10px; /* Tighter gap */
    align-items: flex-start;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-result-tile:active {
    transform: scale(0.98);
    background: #f9fafb;
}

.mobile-rank-number {
    min-width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.mobile-college-info {
    flex: 1;
    min-width: 0;
}

.mobile-college-name {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-college-location {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.mobile-college-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 11px;
}

.mobile-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #374151;
}

.mobile-stat-label {
    color: #9ca3af;
}

.mobile-tuition {
    font-weight: 700;
    font-size: 15px;
    color: #2563eb;
    margin-top: 4px;
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */

.mobile-loading {
    text-align: center;
    padding: 40px 20px;
}

.mobile-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mobile-loading-text {
    font-size: 14px;
    color: #6b7280;
}

.mobile-empty-state {
    text-align: center;
    padding: 40px 20px;
}

.mobile-empty-icon {
    font-size: 60px;
    margin-bottom: 16px;
}

.mobile-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.mobile-empty-text {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

/* ============================================
   UTILITIES
   ============================================ */

/* Prevent body scroll when panel is expanded */
body.panel-open {
    overflow: hidden;
}

/* Smooth scrolling */
.panel-results {
    scroll-behavior: smooth;
}

/* Touch improvements */
* {
    -webkit-tap-highlight-color: transparent;
}

button, a, .mobile-result-tile, .panel-collapsed {
    -webkit-user-select: none;
    user-select: none;
}

/* ============================================
   LANDSCAPE MODE (Mobile Horizontal)
   ============================================ */

@media screen and (max-width: 768px) and (orientation: landscape) {
    
    .mobile-bottom-panel {
        max-width: 400px;
        right: 0;
        left: auto;
        height: 100%;
        border-radius: 0;
    }
    
    .mobile-bottom-panel.expanded {
        transform: translateX(0);
    }
    
    .panel-expanded {
        height: 100vh;
    }
    
    .mobile-map-container {
        right: 60px; /* Space for collapsed panel */
    }
}

/* ============================================
   SMALL PHONES (< 375px)
   ============================================ */

@media screen and (max-width: 375px) {
    
    .mobile-search-bar input {
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .mobile-search-bar button {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
    
    .mobile-college-name {
        font-size: 13px;
    }
    
    .mobile-college-location {
        font-size: 11px;
    }
}

/* ============================================
   MOBILE ABOUT BUTTON - Now inline with search bar
   See mobile-search-bar section above for styles
   ============================================ */

/* Old positioning removed - now inline */

/* Hide desktop About button on mobile */
@media screen and (max-width: 768px) {
    /* Hide the desktop About button */
    .desktop-container .about-button,
    .desktop-container #aboutButton,
    .desktop-container button[onclick*="About"],
    .about-btn:not(.mobile-about-btn) {
        display: none !important;
    }
}

/* Aggressively hide desktop About button on mobile */
@media screen and (max-width: 768px) {
    /* Hide floating About button from desktop */
    .floating-copyright + * button,
    button[id*="bout"],
    button[class*="bout"]:not(.mobile-about-btn),
    .about-modal-trigger,
    /* Target the specific button you saw in screenshot */
    body > button:not(.mobile-about-btn):not(#mobileSearchBtn):not(.panel-close) {
        display: none !important;
    }
}

/* Force mobile About button to be visible */
@media screen and (max-width: 768px) {
    /* Ensure mobile About button shows */
    #mobileAboutBtn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
    }
    
    /* Hide any buttons created by desktop JS */
    button[style*="position: fixed"]:not(#mobileSearchBtn):not(#mobileAboutBtn):not(.panel-close) {
        display: none !important;
    }
}

/* Position copyright below panel on mobile */
@media screen and (max-width: 768px) {
    .floating-copyright {
        position: fixed !important;
        bottom: 5px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 1400 !important; /* Below panel (1500) */
        font-size: 10px !important;
        color: #9ca3af !important;
        text-align: center !important;
    }
    
    /* When panel is expanded, hide copyright */
    body.panel-open .floating-copyright {
        display: none !important;
    }
}

/* Ensure panel is above everything */
.mobile-bottom-panel {
    z-index: 1500 !important;
}

.mobile-bottom-panel.expanded {
    z-index: 1600 !important;
}

/* Force info button to show - add at very end */
#mobileAboutBtn {
    display: flex !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
}

/* Copyright on map - mobile version */
@media screen and (max-width: 768px) {
    .floating-copyright {
        position: absolute !important;
        bottom: 70px !important; /* Above collapsed panel */
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 500 !important;
        
        /* Simple desktop style - no bubble */
        background: none !important;
        color: #64748b !important; /* Gray text */
        font-size: 11px !important;
        font-weight: 400 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        text-shadow: 0 1px 2px rgba(255,255,255,0.8) !important; /* Slight white shadow for readability */
    }
}

/* Bug fix -About Modal Close Button - Force visibility on mobile */
@media screen and (max-width: 768px) {
    /* Ensure modal header has flexbox layout */
    .about-modal-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 16px 20px !important;
        flex-wrap: nowrap !important;
    }
    
    /* Make title flexible but don't let it push close button off screen */
    .about-modal-header h2 {
        flex: 1 !important;
        margin-right: 12px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    
    /* Force close button to show and size properly for touch */
    .about-close-btn,
    #closeAboutModal {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        align-items: center !important;
        justify-content: center !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        flex-shrink: 0 !important;
        background: rgba(255, 255, 255, 0.2) !important;
        border: none !important;
        border-radius: 50% !important;
        color: white !important;
        font-size: 24px !important;
        font-weight: 700 !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 100 !important;
    }
    
    /* Active state for touch feedback */
    .about-close-btn:active,
    #closeAboutModal:active {
        background: rgba(255, 255, 255, 0.3) !important;
        transform: scale(0.95) !important;
    }
}