/* Mobile Drawer Styles for AMFM Maps Filter Widget */

/* Default: show filter content on all screen sizes */
.amfm-drawer-enabled .amfm-filter-buttons-container {
    display: block !important;
}

.amfm-drawer-enabled .amfm-filter-title {
    display: block !important;
}

/* Mobile Drawer Overlay */
.amfm-mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2147483646;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.amfm-mobile-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Drawer */
.amfm-mobile-drawer {
    position: fixed;
    background: white;
    z-index: 2147483647;
    transition: transform 0.3s ease-in-out;
    display: none; /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
}

/* Default drawer (from bottom) */
.amfm-mobile-drawer,
.amfm-mobile-drawer.amfm-slide-bottom {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateY(100%);
}

.amfm-mobile-drawer.active,
.amfm-mobile-drawer.amfm-slide-bottom.active {
    transform: translateY(0);
}

/* Drawer from top */
.amfm-mobile-drawer.amfm-slide-top {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateY(-100%);
}

.amfm-mobile-drawer.amfm-slide-top.active {
    transform: translateY(0);
}

/* Drawer from left */
.amfm-mobile-drawer.amfm-slide-left {
    top: 0;
    left: 0;
    width: 85%;
    max-width: 400px;
    height: 100%;
    transform: translateX(-100%);
}

.amfm-mobile-drawer.amfm-slide-left.active {
    transform: translateX(0);
}

/* Drawer from right */
.amfm-mobile-drawer.amfm-slide-right {
    top: 0;
    right: 0;
    left: auto;
    width: 85%;
    max-width: 400px;
    height: 100%;
    transform: translateX(100%);
}

.amfm-mobile-drawer.amfm-slide-right.active {
    transform: translateX(0);
}

/* Shadow effects for side drawers */
.amfm-mobile-drawer.amfm-slide-left {
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}

.amfm-mobile-drawer.amfm-slide-right {
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
}

/* Responsive adjustments for side drawers */
@media (max-width: 480px) {
    .amfm-mobile-drawer.amfm-slide-left,
    .amfm-mobile-drawer.amfm-slide-right {
        width: 90%;
        max-width: none;
    }
}

@media (max-width: 320px) {
    .amfm-mobile-drawer.amfm-slide-left,
    .amfm-mobile-drawer.amfm-slide-right {
        width: 95%;
    }
}

/* Mobile Drawer Header */
.amfm-mobile-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    flex-shrink: 0;
}

.amfm-mobile-drawer-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.amfm-mobile-drawer-close {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.amfm-mobile-drawer-close:hover {
    background-color: #e0e0e0;
    color: #333;
}

/* Mobile Drawer Content */
.amfm-mobile-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

/* Filter styling inside drawer */
.amfm-mobile-drawer-content .amfm-filter-title {
    margin-bottom: 20px;
}

.amfm-mobile-drawer-content .amfm-filter-title h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.amfm-mobile-drawer-content .amfm-filter-buttons-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.amfm-mobile-drawer-content .amfm-filter-group-buttons {
    margin-bottom: 0;
}

.amfm-mobile-drawer-content .amfm-filter-group-title {
    display: block;
    font-weight: 600;
    font-size: 16px;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.amfm-mobile-drawer-content .amfm-filter-button {
    display: inline-block;
    margin: 4px 6px 4px 0;
    padding: 10px 16px;
    background: #ffffff;
    border: 2px solid #dee2e6;
    color: #495057;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    user-select: none;
    min-height: 44px; /* Touch-friendly minimum height */
    box-sizing: border-box;
}

.amfm-mobile-drawer-content .amfm-filter-button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.amfm-mobile-drawer-content .amfm-filter-button.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

/* Classes controlled by JavaScript based on dynamic breakpoint */
.amfm-drawer-enabled.amfm-is-mobile .amfm-filter-buttons-container {
    display: none !important;
}

.amfm-drawer-enabled.amfm-is-mobile .amfm-filter-title {
    display: none !important;
}

.amfm-drawer-enabled.amfm-is-mobile .amfm-mobile-drawer {
    display: flex;
}

/* When drawer is active, show the content inside it */
.amfm-mobile-drawer.active .amfm-mobile-drawer-content .amfm-filter-buttons-container {
    display: block !important;
}

.amfm-mobile-drawer.active .amfm-mobile-drawer-content .amfm-filter-title {
    display: block !important;
}

/* Additional responsive improvements for smaller screens */
@media (max-width: 480px) {
    .amfm-mobile-drawer-header {
        padding: 16px;
    }
    
    .amfm-mobile-drawer-title {
        font-size: 16px;
    }
    
    .amfm-mobile-drawer-content {
        padding: 16px;
    }
    
    .amfm-mobile-drawer-content .amfm-filter-button {
        padding: 12px 16px;
        font-size: 14px;
        margin: 3px 4px 3px 0;
        min-height: 48px; /* Larger touch target on small screens */
    }
    
    .amfm-mobile-drawer-content .amfm-filter-group-title {
        font-size: 15px;
        margin-bottom: 10px;
    }
}

/* Animation improvements for smoother experience */
.amfm-mobile-drawer * {
    -webkit-tap-highlight-color: transparent;
}

/* Prevent body scroll when drawer is open */
body.amfm-drawer-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Loading state for drawer */
.amfm-mobile-drawer.loading .amfm-mobile-drawer-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.amfm-mobile-drawer.loading .amfm-mobile-drawer-content::before {
    content: "Loading filters...";
    font-size: 16px;
    color: #666;
}

/* Mobile Filter Button Styles */
.amfm-mobile-filter-button {
    position: absolute;
    z-index: 99;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 12px 20px;
    background-color: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    min-height: 48px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.amfm-mobile-filter-button:hover {
    background-color: #0056b3;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.amfm-mobile-filter-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.amfm-mobile-filter-button i,
.amfm-mobile-filter-button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.amfm-mobile-filter-button span {
    white-space: nowrap;
}

/* Show filter button only on mobile */
@media (max-width: 768px) {
    .amfm-filter-container {
        max-height: 0px !important;
    }
    .amfm-mobile-filter-button {
        display: flex;
    }
}

/* Hide filter button on desktop */
@media (min-width: 769px) {
    .amfm-mobile-filter-button {
        display: none !important;
    }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 480px) {
    .amfm-mobile-filter-button {
        padding: 10px 16px;
        font-size: 13px;
        min-height: 44px;
    }
    
    .amfm-mobile-filter-button i,
    .amfm-mobile-filter-button svg {
        width: 14px;
        height: 14px;
    }
}

/* Ensure button stays above map controls and is positioned relative to map container */
.amfm-map-container {
    position: relative;
    overflow: hidden; /* Prevent button from going outside container bounds */
}

/* Animation for button appearance */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.amfm-mobile-filter-button {
    animation: fadeInUp 0.3s ease-out;
}

/* Pulse animation for attention */
@keyframes pulse {
    0% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 2px 12px rgba(0, 123, 255, 0.4);
    }
    100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
}

.amfm-mobile-filter-button.pulse {
    animation: pulse 2s infinite;
}