/* --- Main Button --- */
#restaurant-locator-button {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

#restaurant-locator-button:hover {
    background-color: #3e8e41;
}

/* --- Modal --- */
#restaurant-locator-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #FFFFFF;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.modal-content h2 {
    font-size: 25px !important;
}

/* --- Close Button --- */
#restaurant-locator-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    transition: color 0.3s ease;
}

#restaurant-locator-close:hover,
#restaurant-locator-close:focus {
    color: #000;
}

/* --- Form --- */
#restaurant-locator-form {
    position: relative;
    margin-bottom: 20px;
}

.input-wrapper {
    position: relative;
    margin-bottom: 15px;
}

#restaurant-locator-address {
    width: 100%;
    padding: 12px;
    padding-right: 40px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
}

#find-me-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #007bff;
    transition: color 0.3s ease;
}

#find-me-btn:hover {
    color: #0056b3;
}

#find-stores-btn {
    width: 100%;
    padding: 12px;
    background-color: #ccc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: not-allowed;
    font-size: 16px;
    transition: all 0.3s ease;
    opacity: 0.7;
}

#find-stores-btn.active {
    background-color: #007bff;
    cursor: pointer;
    opacity: 1;
}

#find-stores-btn.active:hover {
    background-color: #0056b3;
}

/* --- Loading Indicator --- */
#restaurant-locator-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    gap: 10px;
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Results --- */
#restaurant-locator-results {
    margin-top: 20px;
}

#restaurant-locator-results h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
    color: #333;
    font-size: 1.5em;
}

.store-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.store-item {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    transition: background-color 0.3s ease;
}

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

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

.store-header {
    margin-bottom: 8px;
}

.store-name {
    font-weight: bold;
    color: #333;
    font-size: 1.1em;
}

.store-distance {
    color: #666;
    margin-left: 5px;
}

.store-address {
    color: #666;
    margin-bottom: 12px;
    font-size: 0.9em;
}

.store-link {
    display: inline-block;
    padding: 8px 16px;
    background-color: #C33130;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    font-size: 0.9em;
}

.store-link:hover {
    background-color: #45a049;
    text-decoration: none;
    color: white;
}

/* --- Error Message --- */
.error-message {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.9em;
}

/* --- Google Places Autocomplete Customization --- */
.pac-container {
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    border: 1px solid #ddd;
    border-top: none;
}

.pac-item {
    padding: 8px;
    font-size: 14px;
    cursor: pointer;
}

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

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 15px;
    }

    #restaurant-locator-address {
        font-size: 16px; /* Better for mobile input */
    }

    .store-name {
        display: block;
        margin-bottom: 5px;
    }

    .store-distance {
        display: block;
        margin-left: 0;
        margin-bottom: 8px;
    }

    .store-link {
        width: 100%;
        text-align: center;
    }
}

/* --- Accessibility Improvements --- */
#restaurant-locator-button:focus,
#restaurant-locator-address:focus,
#find-me-btn:focus,
#find-stores-btn:focus,
.store-link:focus {
    outline: 3px solid #007bff;
    outline-offset: 2px;
}

/* --- Print Styles --- */
@media print {
    #restaurant-locator-modal {
        position: static;
        background: none;
    }

    .modal-content {
        box-shadow: none;
        border: none;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    #restaurant-locator-close,
    #restaurant-locator-form,
    .store-link {
        display: none;
    }

    .store-item {
        page-break-inside: avoid;
    }
}