/* Mobile-specific styles for FindMyMap application */

/* Bottom Sheet Component */
.mobile-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1500;
    transition: height 0.3s ease;
    overflow: hidden;
}

.bottom-sheet-handle {
    width: 40px;
    height: 5px;
    background-color: #dadce0;
    border-radius: 3px;
    margin: 12px auto;
    cursor: grab;
}

.bottom-sheet-handle:active {
    cursor: grabbing;
}

.bottom-sheet-content {
    padding: 0 16px 16px;
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #dadce0;
    margin-bottom: 16px;
}

.bottom-sheet-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.bottom-sheet-close {
    background: none;
    border: none;
    color: #5f6368;
    font-size: 18px;
    cursor: pointer;
}

.bottom-sheet-body {
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
    color: #5f6368;
    text-align: center;
}

.mobile-bottom-sheet.dragging {
    transition: none;
}

/* Quick Action Buttons */
.quick-action-buttons {
    position: fixed;
    bottom: 80px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1400;
}

.quick-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #000000;
    color: white;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.quick-action-btn i {
    font-size: 20px;
}

.quick-action-btn span {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.7);
    color: rgb(0, 0, 0);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    right: 64px;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.quick-action-btn:hover span {
    opacity: 1;
    transform: translateX(0);
}

.quick-action-btn:active {
    transform: scale(0.95);
}

/* Autocomplete Suggestions */
.autocomplete-container {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1100;
    max-height: 300px;
    overflow-y: auto;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f4;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: #f8f9fa;
}

.autocomplete-icon {
    color: #4285F4;
    margin-right: 12px;
    font-size: 16px;
}

.autocomplete-text {
    flex: 1;
}

.autocomplete-main {
    font-size: 14px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 2px;
}

.autocomplete-secondary {
    font-size: 12px;
    color: #5f6368;
}

/* Pull to Refresh */
.pull-to-refresh-indicator {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1300;
    transition: transform 0.2s ease;
}

.pull-to-refresh-indicator i {
    color: #4285F4;
    font-size: 20px;
}

.pull-to-refresh-indicator.refreshing i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    /* Adjust search box for better mobile experience */
    .search-container {
        top: 10px;
        left: 60px;
        width: calc(100% - 70px);
        max-width: none;
    }
    
    /* Improve controls panel styling to be more Google Maps-like */
    .controls-panel {
        padding: 0;
        height: 100%;
    }
    
    .controls-header {
        padding: 16px;
        background-color: #f8f9fa;
        border-bottom: 1px solid #e0e0e0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .controls-body {
        padding: 16px;
        overflow-y: auto;
        height: calc(100% - 56px);
    }
    
    /* Add overlay when sidebar is active */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1400;
        pointer-events: auto;
        cursor: pointer;
    }
    
    body:has(#controls-sidebar.active) .sidebar-overlay {
        display: block;
    }
    
    /* Make buttons more tappable */
    .map-button {
        padding: 10px 16px;
        margin: 6px 0;
    }
    
    /* Improve form controls for touch */
    .form-select, .form-input {
        padding: 12px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Make map layers control more accessible */
    .map-layers-control {
        display: none; /* Hidden by default, shown via quick action button */
    }
    
    .map-layers-control.visible {
        display: block;
        position: fixed;
        top: 70px;
        right: 10px;
        z-index: 1400;
    }
    
    /* Adjust directions panel to use bottom sheet instead */
    .directions-panel {
        display: none; /* Use bottom sheet instead */
    }
    
    /* Route information styling in bottom sheet */
    .route-details-container {
        padding: 10px 0;
    }
    
    .route-summary {
        display: flex;
        justify-content: space-between;
        padding: 10px 15px;
        background-color: #f8f9fa;
        border-radius: 8px;
        margin-bottom: 15px;
    }
    
    .route-distance, .route-duration {
        display: flex;
        align-items: center;
        gap: 8px;
        font-weight: 500;
    }
    
    .route-steps-container {
        max-height: 60vh;
        overflow-y: auto;
        padding-right: 5px;
    }
    
    .route-step {
        display: flex;
        padding: 12px 5px;
        border-bottom: 1px solid #eee;
        align-items: center;
    }
    
    .current-step {
        background-color: #e8f0fe;
        border-radius: 8px;
    }
    
    .step-icon {
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #4285F4;
        color: white;
        border-radius: 50%;
        margin-right: 12px;
        flex-shrink: 0;
    }
    
    .step-details {
        flex: 1;
    }
    
    .step-instruction {
        font-weight: 500;
        margin-bottom: 4px;
    }
    
    .step-distance {
        font-size: 12px;
        color: #5f6368;
    }
    
    /* Live navigation styling */
    .live-navigation-container {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    .current-instruction {
        display: flex;
        align-items: center;
        background-color: #e8f0fe;
        padding: 15px;
        border-radius: 8px;
        margin-bottom: 10px;
    }
    
    .instruction-icon {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #4285F4;
        color: white;
        border-radius: 50%;
        margin-right: 15px;
        flex-shrink: 0;
        font-size: 18px;
    }
    
    .instruction-text {
        font-weight: 500;
        font-size: 16px;
        flex: 1;
    }
    
    .navigation-info {
        display: flex;
        justify-content: space-between;
        padding: 10px 0;
    }
    
    .info-item {
        display: flex;
        align-items: center;
        gap: 8px;
        font-weight: 500;
    }
    
    .navigation-controls {
        display: flex;
        gap: 10px;
        margin-top: 15px;
    }
    
    .navigation-controls button {
        flex: 1;
        padding: 12px;
        border-radius: 8px;
    }
    
    /* Improve mobile toggle button */
    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        padding: 10px 12px;
        font-weight: 500;
        font-size: 14px;
        background-color: white;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        width: auto;
        height: 40px;
        top: 10px;
        left: 10px;
        position: fixed;
        z-index: 1001;
        color: #3c4043;
    }
    
    .mobile-toggle i {
        margin-right: 8px;
        font-size: 16px;
        color: #4285F4;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .mobile-bottom-sheet,
    .quick-action-btn,
    .autocomplete-container,
    .autocomplete-item,
    .pull-to-refresh-indicator {
        background-color: #ffffff;
        color: #000000;
    }
    
    .bottom-sheet-handle {
        background-color: #5f6368;
    }
    
    .bottom-sheet-header {
        border-bottom-color: #3c4043;
    }
    
    .bottom-sheet-close {
        color: #9aa0a6;
    }
    
    .placeholder-content,
    .autocomplete-secondary {
        color: #9aa0a6;
    }
    
    .autocomplete-main {
        color: #e8eaed;
    }
    
    .autocomplete-item {
        border-bottom-color: #3c4043;
    }
    
    .autocomplete-item:hover {
        background-color: #303134;
    }
}