/* ============================================================================
   MOBILE-FIRST RESPONSIVE ENHANCEMENTS FOR HOSTELO HUB
   Add this CSS file after your main.css and home.css
   ============================================================================ */

/* ============================================================================
   1. MOBILE-OPTIMIZED TYPOGRAPHY
   ============================================================================ */
@media (max-width: 768px) {
    html {
        font-size: 14px; /* Base font size reduction for mobile */
    }
    
    body {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

/* ============================================================================
   2. ENHANCED NAVBAR FOR MOBILE
   ============================================================================ */
@media (max-width: 768px) {
    .navbar {
        padding: 10px 0;
        position: fixed;
        width: 100%;
        left: 0;
        right: 0;
    }
    
    .navbar-content {
        padding: 0 15px;
        position: relative;
    }
    
    /* Mobile Menu Toggle Button */
    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: transparent;
        border: none;
        cursor: pointer;
        z-index: 1001;
        transition: all 0.3s ease;
    }
    
    .menu-toggle:active {
        transform: scale(0.9);
    }
    
    /* Hamburger Icon Animation */
    .menu-toggle i {
        font-size: 24px;
        color: var(--primary-blue);
        transition: transform 0.3s ease;
    }
    
    .menu-toggle.active i::before {
        content: "\f00d"; /* Font Awesome times icon */
    }
    
    /* Mobile Navigation Menu */
    .nav-links {
        position: fixed;
        top: 62px;
        left: 0;
        right: 0;
        background: var(--bg-white);
        flex-direction: column;
        align-items: stretch !important;
        padding: 0;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
        transform: translateX(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        max-height: calc(100vh - 62px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 999;
    }
    
    .nav-links.open {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-links a,
    .nav-links .cta-btn {
        padding: 18px 25px;
        border-bottom: 1px solid var(--border-light);
        font-size: 15px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        transition: all 0.2s ease;
        width: 100%;
        text-align: left;
    }
    
    .nav-links a::after {
        content: "\f054"; /* Font Awesome chevron-right */
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        font-size: 12px;
        color: var(--text-light);
        transition: transform 0.2s ease;
    }
    
    .nav-links a:active,
    .nav-links .cta-btn:active {
        background: var(--bg-light);
    }
    
    .nav-links .cta-btn {
        margin: 15px;
        border-radius: 8px;
        border-bottom: none;
        justify-content: center;
        padding: 15px 25px;
    }
    
    .nav-links .cta-btn::after {
        display: none;
    }
    
    /* Logo Adjustments */
    .logo {
        font-size: 20px;
    }
    
    .logo-icon {
        width: 35px;
        height: 35px;
    }
    
    .logo-icon img {
        width: 35px;
        height: 35px;
    }
    
    /* Hide desktop search in navbar */
    .nav-search {
        display: none;
    }
    
    /* Mobile User Menu */
    .nav-right,
    .nav-actions {
        gap: 10px;
    }
    
    .user-menu {
        padding: 5px 10px;
    }
    
    .user-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .user-info {
        display: none; /* Hide username on mobile */
    }
    
    .icon-btn {
        font-size: 20px;
        padding: 8px;
    }
    
    .notification-badge {
        top: -5px;
        right: -5px;
        font-size: 9px;
        padding: 2px 5px;
    }
}

/* ============================================================================
   3. MOBILE-OPTIMIZED DROPDOWNS
   ============================================================================ */
@media (max-width: 768px) {
    #notificationDropdown,
    #userMenuDropdown {
        position: fixed !important;
        top: 62px !important;
        left: 15px !important;
        right: 15px !important;
        width: auto !important;
        max-width: none !important;
        max-height: calc(100vh - 80px) !important;
        border-radius: 10px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.2) !important;
    }
    
    #notificationDropdown {
        max-height: 70vh !important;
    }
    
    #userMenuDropdown a {
        padding: 18px 20px;
        font-size: 15px;
        border-bottom: 1px solid var(--border-light);
    }
    
    #userMenuDropdown a:last-child {
        border-bottom: none;
    }
}

/* ============================================================================
   4. TOUCH-FRIENDLY INTERACTIONS
   ============================================================================ */
@media (max-width: 768px) {
    /* Larger tap targets for mobile */
    button,
    a,
    .btn,
    .icon-btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px; /* Apple's recommended minimum tap target */
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    @media (hover: none) {
        *:hover {
            transform: none !important;
        }
        
        .btn-primary:hover,
        .cta-btn:hover,
        .btn-secondary:hover {
            transform: none !important;
        }
    }
    
    /* Active states for touch feedback */
    button:active,
    .btn:active,
    .icon-btn:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* ============================================================================
   5. MOBILE-OPTIMIZED HERO SECTION
   ============================================================================ */
@media (max-width: 768px) {
    .hero {
        padding: 90px 0 40px;
        min-height: auto;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }
    
    .hero-left {
        order: 1;
    }
    
    .hero-right {
        order: 2;
        min-height: 250px;
    }
    
    .hero-title {
        font-size: 28px;
        line-height: 1.3;
        margin-bottom: 15px;
    }
    
    .hero-subtitle {
        font-size: 15px;
        margin-bottom: 25px;
    }
    
    .live-badge {
        padding: 10px 20px;
        font-size: 13px;
        margin-bottom: 20px;
        display: inline-flex;
    }
    
    /* Mobile Search Box */
    .search-box {
        flex-direction: column;
        padding: 15px;
        gap: 12px;
        border-radius: 15px;
    }
    
    .search-box i {
        display: none; /* Hide icon on mobile for space */
    }
    
    .search-box input {
        width: 100%;
        padding: 15px;
        font-size: 15px;
        border-radius: 10px;
        border: 1px solid var(--border-light);
    }
    
    .search-btn {
        width: 100%;
        padding: 15px 30px;
        border-radius: 10px;
        font-size: 15px;
        justify-content: center;
    }
    
    .hero-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-top: 25px;
    }
    
    .stat {
        padding: 15px;
        background: white;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    }
    
    .stat-number {
        font-size: 28px;
        margin-bottom: 5px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .hero-illustration {
        height: 250px;
        border-radius: 15px;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 80px 0 30px;
    }
    
    .hero-title {
        font-size: 24px;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
    
    .stat-number {
        font-size: 24px;
    }
}

/* ============================================================================
   6. MOBILE-OPTIMIZED CARDS & GRIDS
   ============================================================================ */
@media (max-width: 768px) {
    /* Generic Card Styles */
    .card,
    .section-card,
    .feature-card,
    .step-card,
    .stat-card {
        padding: 20px;
        margin-bottom: 15px;
    }
    
    /* Localities Grid */
    .localities-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .city-localities-card {
        padding: 20px;
    }
    
    .city-header h3 {
        font-size: 22px;
    }
    
    .locality-item {
        padding: 12px;
        font-size: 14px;
    }
    
    /* Featured Hostels Grid */
    .featured-hostels-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .featured-hostel-card {
        max-width: 100%;
    }
    
    /* Hostel Card Details */
    .hostel-card {
        display: flex;
        flex-direction: column;
    }
    
    .hostel-image {
        height: 200px;
        border-radius: 10px 10px 0 0;
    }
    
    .hostel-info {
        padding: 15px;
    }
    
    .hostel-name {
        font-size: 17px;
        line-height: 1.3;
    }
    
    .hostel-details {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .detail-item {
        flex: 1 1 45%;
        min-width: 120px;
    }
    
    .hostel-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-details,
    .btn-book {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
    
    /* Features Grid */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .feature-card {
        text-align: center;
        padding: 25px 20px;
    }
    
    .feature-card i {
        font-size: 40px;
        margin-bottom: 15px;
    }
    
    /* Steps Grid */
    .steps-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .step-card {
        padding: 25px 20px;
    }
}

/* ============================================================================
   7. MOBILE-OPTIMIZED FORMS
   ============================================================================ */
@media (max-width: 768px) {
    .form-group,
    .input-group {
        margin-bottom: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        width: 100%;
        padding: 15px;
        font-size: 15px;
        border-radius: 8px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    /* Better touch target for checkboxes and radios */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        margin-right: 10px;
    }
    
    label {
        font-size: 14px;
        margin-bottom: 8px;
        display: block;
    }
    
    /* Form buttons */
    .form-actions {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .form-actions .btn,
    .form-actions button {
        width: 100%;
        padding: 15px;
        font-size: 15px;
    }
}

/* ============================================================================
   8. MOBILE-OPTIMIZED TABLES
   ============================================================================ */
@media (max-width: 768px) {
    /* Card-style tables for mobile */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: none;
    }
    
    table thead {
        display: none;
    }
    
    table tbody {
        display: block;
        width: 100%;
    }
    
    table tr {
        display: block;
        margin-bottom: 15px;
        background: white;
        border-radius: 10px;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }
    
    table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-light);
    }
    
    table td:last-child {
        border-bottom: none;
    }
    
    table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-medium);
        flex: 0 0 40%;
    }
}

/* ============================================================================
   9. MOBILE-OPTIMIZED MODALS
   ============================================================================ */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        width: calc(100% - 20px);
        max-width: none;
        margin: 10px;
        padding: 25px 20px;
        border-radius: 15px;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-header {
        padding-bottom: 15px;
        margin-bottom: 20px;
    }
    
    .modal-header h2,
    .modal-header h3 {
        font-size: 20px;
    }
    
    .modal-close {
        width: 35px;
        height: 35px;
        font-size: 24px;
    }
    
    .modal-body {
        padding: 0;
    }
    
    .modal-footer {
        padding-top: 20px;
        margin-top: 20px;
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* ============================================================================
   10. MOBILE-OPTIMIZED PAGINATION
   ============================================================================ */
@media (max-width: 768px) {
    .pagination {
        gap: 5px;
        padding: 0 10px;
    }
    
    .pagination button,
    .pagination a {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        padding: 0 10px;
    }
    
    /* Show only first, last, current, and adjacent pages */
    .pagination button:not(.active):not(:first-child):not(:last-child):not(.prev):not(.next) {
        display: none;
    }
    
    .pagination button.active ~ button:nth-child(-n+2),
    .pagination button.active ~ button:nth-last-child(-n+2) {
        display: flex;
    }
}

/* ============================================================================
   11. MOBILE-OPTIMIZED FILTERS & SORTING
   ============================================================================ */
@media (max-width: 768px) {
    .filters-section,
    .filter-bar {
        flex-direction: column;
        gap: 12px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-btn,
    .sort-btn {
        width: 100%;
        padding: 12px 20px;
        justify-content: center;
    }
    
    .city-filter {
        gap: 10px;
    }
    
    .filter-btn {
        flex: 1 1 auto;
        min-width: 120px;
        font-size: 13px;
    }
}

/* ============================================================================
   12. MOBILE-OPTIMIZED FOOTER
   ============================================================================ */
@media (max-width: 768px) {
    .footer {
        padding: 40px 0 20px;
        margin-top: 50px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .footer-col {
        text-align: center;
    }
    
    .footer-col h4 {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    .footer-col a {
        font-size: 13px;
        padding: 8px 0;
    }
    
    .social-links {
        justify-content: center;
        gap: 12px;
    }
    
    .social-icon {
        width: 38px;
        height: 38px;
    }
    
    .footer-bottom {
        font-size: 12px;
        padding-top: 20px;
    }
}

/* ============================================================================
   13. MOBILE-OPTIMIZED DASHBOARD & SIDEBAR
   ============================================================================ */
@media (max-width: 768px) {
    .dashboard-container {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 20px;
    }
    
    .sidebar,
    .settings-sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 0;
        background: transparent;
    }
    
    .sidebar-menu,
    .settings-menu {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 10px;
        padding: 10px 0;
        white-space: nowrap;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .sidebar-menu::-webkit-scrollbar,
    .settings-menu::-webkit-scrollbar {
        display: none;
    }
    
    .sidebar-menu li,
    .settings-menu li {
        flex: 0 0 auto;
    }
    
    .sidebar-menu a,
    .settings-menu a {
        padding: 12px 20px;
        border-radius: 20px;
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 14px;
        white-space: nowrap;
        border-left: none;
        border: 2px solid transparent;
    }
    
    .sidebar-menu a.active,
    .settings-menu a.active {
        background: var(--gradient-orange);
        color: white;
        border-color: var(--primary-orange);
    }
    
    .main-content {
        padding: 0;
    }
}

/* ============================================================================
   14. MOBILE-OPTIMIZED UTILITY CLASSES
   ============================================================================ */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
    
    .mobile-flex {
        display: flex !important;
    }
    
    .mobile-center {
        text-align: center !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-no-padding {
        padding: 0 !important;
    }
    
    .mobile-small-padding {
        padding: 15px !important;
    }
    
    .mobile-no-margin {
        margin: 0 !important;
    }
}

/* ============================================================================
   15. MOBILE-OPTIMIZED TOAST/NOTIFICATIONS
   ============================================================================ */
@media (max-width: 768px) {
    .toast,
    .notification-toast {
        left: 15px;
        right: 15px;
        bottom: 15px;
        max-width: none;
        border-radius: 10px;
        padding: 15px;
        font-size: 14px;
    }
}

/* ============================================================================
   16. MOBILE-OPTIMIZED LOADING STATES
   ============================================================================ */
@media (max-width: 768px) {
    .loading-spinner {
        width: 40px;
        height: 40px;
    }
    
    .skeleton {
        border-radius: 8px;
    }
}

/* ============================================================================
   17. IMPROVED TOUCH SCROLLING
   ============================================================================ */
@media (max-width: 768px) {
    /* Smooth scrolling for all scrollable containers */
    .scrollable,
    .overflow-auto,
    .overflow-scroll {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Hide scrollbars on mobile for cleaner look */
    .hide-scrollbar::-webkit-scrollbar {
        display: none;
    }
    
    .hide-scrollbar {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* ============================================================================
   18. MOBILE-OPTIMIZED IMAGES
   ============================================================================ */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
    
    .img-fluid {
        width: 100%;
        height: auto;
        object-fit: cover;
    }
    
    /* Lazy loading placeholder */
    img[loading="lazy"] {
        background: var(--bg-lighter);
    }
}

/* ============================================================================
   19. SAFE AREA INSETS (for notched devices)
   ============================================================================ */
@media (max-width: 768px) {
    @supports (padding-top: env(safe-area-inset-top)) {
        .navbar {
            padding-top: calc(10px + env(safe-area-inset-top));
        }
        
        .hero {
            padding-top: calc(90px + env(safe-area-inset-top));
        }
        
        .footer {
            padding-bottom: calc(20px + env(safe-area-inset-bottom));
        }
        
        .modal {
            padding-bottom: calc(10px + env(safe-area-inset-bottom));
        }
    }
}

/* ============================================================================
   20. MOBILE-SPECIFIC ANIMATIONS (Reduced for Performance)
   ============================================================================ */
@media (max-width: 768px) {
    /* Disable complex animations on mobile for better performance */
    @media (prefers-reduced-motion: no-preference) {
        .float,
        .pulse,
        .bounce {
            animation-duration: 3s; /* Reduce animation duration */
        }
    }
    
    /* Simpler transitions on mobile */
    * {
        transition-duration: 0.2s !important;
    }
}

/* ============================================================================
   21. LANDSCAPE MODE OPTIMIZATIONS
   ============================================================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 80px 0 30px;
        min-height: auto;
    }
    
    .hero-content {
        gap: 20px;
    }
    
    .hero-title {
        font-size: 24px;
    }
    
    .hero-subtitle {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .hero-illustration {
        height: 200px;
    }
    
    .modal-content {
        max-height: 80vh;
    }
}

/* ============================================================================
   22. HIGH-DPI DISPLAYS (Retina)
   ============================================================================ */
@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2),
       (max-width: 768px) and (min-resolution: 192dpi) {
    /* Optimize text rendering for retina displays */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* ============================================================================
   23. ACCESSIBILITY IMPROVEMENTS FOR MOBILE
   ============================================================================ */
@media (max-width: 768px) {
    /* Ensure focus is visible on mobile */
    *:focus-visible {
        outline: 3px solid var(--primary-orange);
        outline-offset: 3px;
    }
    
    /* Skip to main content link */
    .skip-to-main {
        position: absolute;
        top: -100px;
        left: 0;
        background: var(--primary-orange);
        color: white;
        padding: 15px;
        z-index: 9999;
        transition: top 0.3s;
    }
    
    .skip-to-main:focus {
        top: 0;
    }
}

/* ============================================================================
   24. PRINT STYLES FOR MOBILE
   ============================================================================ */
@media print {
    .navbar,
    .nav-links,
    .menu-toggle,
    .sidebar,
    .footer,
    .btn,
    .modal,
    .cta-btn {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
}
