/* ================================
   MODAL VARIANTS
   ================================ */

/* Search Modals */
.search-modal .modal-content {
   max-width: 500px;
   max-height: 600px;
   width: 90vw;
}

.search-modal .modal-body {
   padding: var(--space-xl);
}

.report-modal .modal-body {
   padding: 0;
}

.report-modal .form-label {
   padding: var(--space-md) var(--space-lg);
}

.report-modal .form-select,
.report-modal .form-input {
   padding: var(--space-lg);
   margin: 0 var(--space-lg) var(--space-md);
}

/* Distance Modal */
.distance-modal .modal-content {
   max-width: 400px;
   width: 90vw;
}

/* Places Search Modal */
.places-search-modal .modal-content {
   max-width: 600px;
   max-height: 80vh;
   width: 95vw;
}


/* About/Info Modals */
.info-modal .modal-content {
   max-width: 600px;
   max-height: 80vh;
   width: 95vw;
}

/* Community Hub Modal */
.community-modal .modal-content {
   max-width: 800px;
   max-height: 90vh;
   width: 98vw;
   height: 90vh;
}

/* ================================
   STATUS MODAL SPECIFIC STYLES
   ================================ */

.status-prompt {
   text-align: center;
   color: var(--text-secondary);
   margin-bottom: var(--space-2xl);
   font-size: var(--text-md);
   line-height: 1.5;
}

.status-option {
   display: flex;
   align-items: center;
   gap: var(--space-lg);
   padding: var(--space-xl);
   background: var(--bg-white);
   border: 3px solid var(--border-light);
   border-radius: var(--radius-xl);
   cursor: pointer;
   transition: all var(--transition);
   text-align: left;
   width: 100%;
   margin: var(--space-sm) 0;
}

.status-option:hover {
   transform: translateY(-2px);
   box-shadow: var(--shadow-lg);
   border-color: var(--border-purple);
   background: linear-gradient(135deg, var(--bg-purple) 0%, rgba(255, 255, 255, 1) 100%);
}

.option-icon {
   font-size: var(--text-4xl);
   min-width: 60px;
   text-align: center;
   line-height: 1;
}

.option-content h4 {
   font-size: var(--text-lg);
   font-weight: 700;
   color: var(--text-primary);
   margin: 0 0 var(--space-xs) 0;
}

.option-content p {
   font-size: var(--text-sm);
   color: var(--text-secondary);
   margin: 0;
   line-height: 1.4;
}

.confirm-status {
   display: inline-flex;
   align-items: center;
   gap: var(--space-md);
   padding: var(--space-lg);
   margin: var(--space-xl) 0;
   background: var(--bg-section);
   border-radius: var(--radius-lg);
   font-size: var(--text-lg);
   font-weight: 700;
   border: 2px solid var(--border-purple);
}

/* ================================
   STATUS PROMPT AFTER BEER REPORT
   ================================ */

.status-prompt-modal .modal-content {
    max-width: 450px;
    padding: 0;
}

.status-prompt-modal .modal-header {
    padding: 1.5rem 1.5rem 1rem;
}

.status-prompt-modal .modal-body {
    padding: 0 1.5rem 1.5rem;
}

.status-options-compact {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-option-compact {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.status-option-compact:hover {
    border-color: var(--purple);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(109, 40, 217, 0.05) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.status-option-compact .option-emoji {
    font-size: 1.5rem;
    min-width: 2rem;
}

.status-option-compact .option-text {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.skip-status-btn {
    margin-top: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem;
    transition: color var(--transition);
}

.skip-status-btn:hover {
    color: var(--text-primary);
}

/* ================================
   DISTANCE MODAL
   ================================ */

.distance-options {
   display: flex;
   flex-direction: column;
   gap: var(--space-sm);
   margin: var(--space-sm);
}

.distance-option {
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-xs);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.distance-option:hover {
    border-color: var(--purple);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    background: linear-gradient(135deg, var(--bg-purple) 0%, rgba(255, 255, 255, 1) 100%);
}

.distance-option.popular {
    border-color: var(--purple);
    background: var(--bg-purple);
}

.distance-option.popular::after {
    content: '👑';
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary-gradient);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: var(--shadow-sm);
}

.distance-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1;
}

.distance-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ================================
   PLACES SEARCH MODAL
   ================================ */

.place-result {
    cursor: pointer;
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    border-radius: var(--radius-lg);
    transition: all var(--transition);
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.place-result:hover {
    background: var(--bg-purple);
    border-color: var(--border-purple);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.place-icon {
    font-size: var(--text-2xl);
    opacity: 0.8;
    transition: all var(--transition);
    min-width: 40px;
    text-align: center;
}

.place-result:hover .place-icon {
    opacity: 1;
    transform: scale(1.1);
}

.place-info {
    flex: 1;
}

.place-info strong {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    font-size: var(--text-lg);
    margin-bottom: var(--space-xs);
    line-height: 1.2;
}

.place-info small {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.place-type {
    display: inline-block;
    background: var(--purple-gradient);
    color: var(--text-white);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 600;
    margin-top: var(--space-xs);
}

/* Selected Place Preview */
.selected-place-preview {
    background: var(--bg-purple);
    border: 2px solid var(--border-purple);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin: var(--space-xl) 0;
    text-align: center;
}

.selected-place-preview h4 {
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    font-size: var(--text-lg);
    font-weight: 700;
}

.place-details {
    margin-bottom: var(--space-xl);
}

.place-details strong {
    display: block;
    font-size: var(--text-xl);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-weight: 700;
}

.place-details div {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-xs);
    line-height: 1.4;
}

/* Manual entry styling */
.place-result[data-action="manual-venue-entry"] {
    background: var(--bg-section);
    border: 2px dashed var(--border-light);
    text-align: center;
    margin-top: var(--space-lg);
    justify-content: center;
}

.place-result[data-action="manual-venue-entry"]:hover {
    border-style: solid;
    background: var(--bg-purple);
    border-color: var(--border-purple);
}

/* Places search input styling */
.places-search-container {
    position: relative;
}

.places-results {
    max-height: 400px;
    overflow-y: auto;
    margin-top: var(--space-md);
    padding: var(--space-sm);
    background: var(--bg-section);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    -webkit-overflow-scrolling: touch;
}

.no-places-found {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.no-places-found p {
    margin-bottom: var(--space-sm);
    font-size: var(--text-lg);
    font-weight: 500;
}

.no-places-found small {
    opacity: 0.8;
    font-size: var(--text-sm);
}

.search-powered-by {
    text-align: center;
    margin-top: var(--space-md);
    opacity: 0.7;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ================================
   DROPDOWN SUGGESTIONS
   ================================ */

.dropdown-header {
    background: var(--primary-gradient);
    color: var(--text-white);
    padding: var(--space-lg) var(--space-xl);
    font-weight: 600;
    font-size: var(--text-sm);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: calc(var(--z-modal-content) + 1);
}

.suggestion-item {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background-color var(--transition);
}

.suggestion-item:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.suggestion-item:hover {
    background-color: var(--hover-subtle);
}

.suggestion-item strong {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    font-size: var(--text-lg);
    margin-bottom: var(--space-xs);
}

.suggestion-item small {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.suggestion-item.add-new-item {
    background-color: var(--bg-purple);
    border-left: 4px solid var(--border-purple);
    border-top: 2px solid var(--border-light);
    margin-top: auto;
}

.suggestion-item.add-new-item:hover {
    background-color: var(--bg-purple);
    opacity: 0.8;
}

/* ================================
   MODAL ANIMATIONS
   ================================ */

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: var(--modal-blur);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
}

.modal.animate-in {
    animation: modalFadeIn 0.3s ease-out;
}

.modal.animate-in .modal-content {
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.animate-out {
    animation: modalFadeIn 0.3s ease-out reverse;
}

.modal.animate-out .modal-content {
    animation: modalSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */

@media (max-width: 768px) {    
    .modal-actions {
        padding: var(--space-md);
        gap: var(--space-sm);
        flex-direction: column;
    }
    
    .status-option {
        padding: var(--space-lg);
        gap: var(--space-md);
    }
    
    .option-icon {
        font-size: var(--text-3xl);
        min-width: 50px;
    }
}

@media (min-width: 1025px) {
    .modal-content {
        max-width: 60vh;
        height: auto;
        width: auto;
    }
    
    /* Larger modals on desktop */
    .search-modal .modal-content {
        max-width: 600px;
    }
    
    .report-modal .modal-content {
        max-width: 700px;
    }
    
    .community-modal .modal-content {
        max-width: 900px;
        max-height: 85vh;
    }
}

/* ================================
   ACCESSIBILITY
   ================================ */

@media (prefers-reduced-motion: reduce) {
    .modal,
    .modal-content,
    .status-option,
    .distance-option,
    .place-result {
        transition: none;
    }
    
    .modal.animate-in,
    .modal.animate-out {
        animation: none;
    }
}

@media (prefers-contrast: high) {
    .modal {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .modal-content {
        border: 2px solid var(--text-primary);
    }
    
    .status-option,
    .distance-option {
        border-width: 3px;
    }
}

/* Focus management */
.modal:focus-within {
    outline: none;
}

.modal-close:focus,
.status-option:focus,
.distance-option:focus,
.place-result:focus {
    outline: 2px solid var(--purple);
    outline-offset: 2px;
}

/* Scrollbar styling */
.modal-body::-webkit-scrollbar,
.places-results::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track,
.places-results::-webkit-scrollbar-track {
    background: var(--bg-section);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb,
.places-results::-webkit-scrollbar-thumb {
    background: var(--purple-gradient);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover,
.places-results::-webkit-scrollbar-thumb:hover {
    background: var(--border-purple);
}

/* ================================================================================
   MODALS.CSS - Updated with Safe Area Support
   Handles proper spacing for devices with home indicators (iPhone X+)
   ================================================================================ */


/* ================================
   SEARCH MODALS
   ================================ */

.search-modal .modal-content {
    /* Slightly smaller max height for search modals */
    max-height: 70vh;
    max-height: 70dvh;
    max-height: calc(70dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}

.distance-content {
    /* Distance modal specific sizing */
    max-height: 60vh;
    max-height: 60dvh;
    max-height: calc(60dvh - env(safe-area-inset-bottom));
}

/* ================================
   FORM MODALS
   ================================ */

.report-modal .modal-body {
    /* Extra padding for long forms */
    padding-bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom));
}

/* ================================
   PROMPT MODALS
   ================================ */

.prompt-modal .modal-content {
    /* Prompt modals are usually smaller */
    max-height: 50vh;
    max-height: 50dvh;
}

/* ================================
   LOCATION MODALS
   ================================ */

.location-permission-card {
   padding: var(--space-lg);
}

.permission-icon {
   font-size: var(--text-3xl);
   display: flex;
   justify-content: center;
}

.permission-title {
   display: flex;
   justify-content: center;
   margin: var(--space-sm);
}

.benefit-itewm {
   display: grid;
   grid-template-columns: 1fr 1fr;
}


/* ================================
   PLACES MODAL
   ================================ */

.places-modal .modal-content {
    max-height: 75vh;
    max-height: 75dvh;
    max-height: calc(80vh - env(safe-area-inset-bottom));
    max-height: calc(80dvh - env(safe-area-inset-bottom));
}

/* ================================
   FULLSCREEN-ISH MODALS
   ================================ */

/* Some modals might want to be nearly fullscreen */
.modal.fullscreen .modal-content {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    margin: 0;
    
    /* Account for safe areas on all sides */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ================================
   MODAL ANIMATIONS
   ================================ */

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================
   RESPONSIVE ADJUSTMENTS
   ================================ */

/* Small phones in landscape */
@media (max-height: 500px) {
    .modal-content {
        max-height: 90vh;
        max-height: 90dvh;
        max-height: calc(95vh - env(safe-area-inset-bottom));
        max-height: calc(95dvh - env(safe-area-inset-bottom));
    }
    
    .modal-header {
        padding: var(--space-md) var(--space-lg);
    }
    
    .modal-body {
        padding: var(--space-md) var(--space-lg);
        padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
    }
}

/* Tablets and larger screens (safe areas usually not needed but doesn't hurt) */
@media (min-width: 768px) {
    .modal-content {
        max-height: 80vh;
        max-height: 80dvh;
        /* Still account for safe areas just in case (iPad Pro with home indicator?) */
        max-height: calc(85vh - env(safe-area-inset-bottom));
        max-height: calc(85dvh - env(safe-area-inset-bottom));
    }
}

/* ================================
   SPECIAL MODAL STATES
   ================================ */

/* When keyboard is open on mobile */
.modal.keyboard-open .modal-content {
    max-height: 50vh;
    max-height: 50dvh;
    transition: max-height 0.3s ease;
}

/* Scrollable modal content */
.modal-body.scrollable {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    
    /* Add some scroll padding for better UX */
    scroll-padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

   
