/* Mobile Menu and Search Fixes */

/* Ensure proper mobile menu dropdown positioning */
.dropdown-content {
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* Mobile hamburger menu button styling */
.mobile-menu-btn {
    padding: 8px;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
    background-color: rgba(0,0,0,0.1);
    transform: scale(1.05);
}

.mobile-menu-btn svg {
    transition: all 0.2s ease;
}

.mobile-menu-btn:hover svg {
    transform: rotate(90deg);
}

/* Mobile search form improvements */
@media (max-width: 768px) {
    /* Ensure search form is properly sized on mobile */
    .search-form-container {
        width: 100% !important;
        max-width: none !important;
    }
    
    /* Mobile search input improvements */
    .search-form-container input {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px; /* Better touch target */
    }
    
    .search-form-container select {
        font-size: 16px;
        min-height: 44px;
    }
    
    .search-form-container button {
        min-height: 48px;
        font-size: 16px;
    }
    
    /* Better mobile dropdown menu */
    .dropdown-content {
        max-height: 80vh;
        overflow-y: auto;
        width: 280px;
        margin-top: 8px;
    }
    
    /* Improve touch targets for mobile menu */
    .dropdown-content li a {
        padding: 12px 16px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Mobile navigation improvements */
    .mobile-nav-item {
        border-bottom: 1px solid rgba(0,0,0,0.05);
        transition: all 0.2s ease;
    }
    
    .mobile-nav-item:last-child {
        border-bottom: none;
    }
    
    .mobile-nav-item:hover {
        background-color: rgba(0,0,0,0.05);
    }
    
    .mobile-nav-item a {
        transition: all 0.2s ease;
        border-radius: 8px;
    }
    
    .mobile-nav-item a:hover {
        background-color: rgba(0,0,0,0.1);
        transform: translateX(4px);
    }
    
    .mobile-nav-item svg {
        transition: all 0.2s ease;
    }
    
    .mobile-nav-item:hover svg {
        transform: scale(1.1);
    }
}

/* Additional mobile menu styling */
.dropdown-content.menu {
    border: 1px solid rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

/* Mobile navbar styling */
@media (max-width: 1024px) {
    .mobile-navbar {
        background: linear-gradient(135deg, var(--primary) 0%, var(--primary-focus) 100%);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border: 1px solid rgba(255,255,255,0.1);
    }
    
    .mobile-navbar .text-navlinks {
        color: rgba(255,255,255,0.9);
        font-weight: 500;
        padding: 8px 12px;
        border-radius: 20px;
        transition: all 0.3s ease;
    }
    
    .mobile-navbar .text-navlinks:hover {
        color: white;
        background-color: rgba(255,255,255,0.1);
        transform: translateY(-2px);
    }
    
    .mobile-navbar .text-navlinks:active {
        transform: translateY(0);
    }
    
    /* Scrollable navbar on small screens */
    .mobile-navbar-container {
        overflow-x: auto;
        overflow-y: visible;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .mobile-navbar-container::-webkit-scrollbar {
        display: none;
    }
    
    .mobile-navbar-container {
        scroll-behavior: smooth;
    }
    
    /* Mobile World dropdown - simplified approach */
    .mobile-world-btn {
        display: flex;
        align-items: center;
        cursor: pointer;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        padding: 8px 12px;
        border-radius: 20px;
        transition: all 0.2s ease;
        background: transparent;
        border: none;
    }
    
    .mobile-world-btn:hover {
        background-color: rgba(255,255,255,0.1);
    }
    
    .mobile-world-btn:active {
        transform: scale(0.95);
    }
    
    .mobile-world-btn svg {
        transition: transform 0.2s ease;
    }
    
    /* External dropdown styling */
    .mobile-world-external-menu {
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        backdrop-filter: blur(10px);
    }
    
    .mobile-world-external-menu h3 {
        border-bottom: 1px solid #e5e7eb;
        padding-bottom: 8px;
        margin-bottom: 12px;
    }
    
    .mobile-world-external-menu a {
        transition: all 0.2s ease;
    }
    
    .mobile-world-external-menu a:hover {
        transform: translateX(2px);
    }
    
    /* Ensure dropdown works on touch devices */
    @media (hover: none) and (pointer: coarse) {
        .mobile-world-btn {
            -webkit-tap-highlight-color: transparent;
        }
    }
}

/* Fix for mobile search form layout */
.mobile-search-wrapper {
    padding: 1rem;
}

/* Better mobile form field spacing */
@media (max-width: 640px) {
    .mobile-search-wrapper .flex-col {
        gap: 1rem;
    }
    
    .mobile-search-wrapper input,
    .mobile-search-wrapper select,
    .mobile-search-wrapper button {
        width: 100%;
    }
}

/* Responsive fixes for search container */
.search-container {
    min-height: 400px;
}

@media (max-width: 1024px) {
    .search-container {
        min-height: auto;
        padding: 1rem;
    }
}

/* Mobile-specific improvements for DaisyUI components */
@media (max-width: 768px) {
    .btn {
        min-height: 48px;
        font-size: 16px;
    }
    
    .input {
        min-height: 44px;
        font-size: 16px;
    }
    
    .select {
        min-height: 44px;
        font-size: 16px;
    }
}

/* Accessibility improvements */
.cursor-pointer:hover {
    opacity: 0.8;
}

.cursor-pointer:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Fix for mobile viewport issues */
@media (max-width: 768px) {
    body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    /* Prevent horizontal scrolling on mobile */
    .container {
        overflow-x: hidden;
    }
}

/* Mobile navbar z-index fixes */
@media (max-width: 1024px) {
    /* Ensure mobile navbar appears above content */
    .mobile-navbar {
        position: relative;
        z-index: 30;
    }
    
    /* Ensure hamburger menu dropdown appears above all content */
    .dropdown-end .dropdown-content {
        z-index: 9999;
        position: fixed;
        right: 1rem;
        top: 80px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        backdrop-filter: blur(16px);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    /* Ensure main content doesn't overlap navbar */
    #root {
        position: relative;
        z-index: 1;
    }
    
    /* Fix for hero sections that might overlap navbar */
    .hero {
        position: relative;
        z-index: 1;
    }
}

/* Roaster page mobile improvements */
@media (max-width: 1024px) {
    /* Make sidebar more compact on mobile */
    .roaster-filter-sidebar {
        background: white;
        border-radius: 1rem;
        padding: 1rem;
        box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        margin-bottom: 1.5rem;
        position: relative;
        z-index: 50;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    /* Ensure main content stays below sidebar */
    main {
        position: relative;
        z-index: 1;
    }
    
    /* Ensure form elements are properly styled on mobile */
    .roaster-filter-sidebar #filterset {
        position: static;
        background: rgba(255, 248, 235, 0.8) !important;
        border-radius: 1rem;
        backdrop-filter: blur(10px);
    }
    
    /* Make sure sidebar doesn't interfere with content */
    .roaster-filter-sidebar .categories-menu h6 {
        margin-bottom: 1rem;
        font-weight: 600;
        color: #374151;
    }
    
    /* Ensure proper grid behavior on mobile */
    .grid {
        gap: 1rem;
    }
    
    /* Adjust card sizing for mobile */
    @media (max-width: 640px) {
        .grid {
            gap: 0.75rem;
        }
        
        .card .p-4 {
            padding: 0.75rem;
        }
        
        .card .text-lg {
            font-size: 0.875rem;
            line-height: 1.25rem;
        }
        
        .card .text-sm {
            font-size: 0.75rem;
            line-height: 1rem;
        }
        
        .card .text-xs {
            font-size: 0.625rem;
            line-height: 0.875rem;
        }
        
        /* Fix badge overflow on mobile */
        .badge {
            max-width: 100px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 0.625rem !important;
            line-height: 0.875rem !important;
        }
        
        .badge-sm {
            font-size: 0.5rem !important;
            padding: 0.25rem 0.5rem;
        }
    }
}

/* Desktop sticky sidebar behavior (without Alpine.js) */
@media (min-width: 1024px) {
    .roaster-filter-sidebar {
        position: sticky;
        top: 1rem;
        align-self: flex-start;
    }
    
    .roaster-filter-sidebar #filterset {
        background: rgba(255, 248, 235, 0.9) !important;
        transition: all 0.3s ease;
    }
    
    .roaster-filter-sidebar:hover #filterset {
        background: rgba(255, 248, 235, 1) !important;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    }
}