/**
 * GPSBooking Map Styles
 */

.gpsbooking-marker {
    /* Markers are created with divIcon in JS */
}

/* OPTION 4: Combo Map + List Styles */

.gpsbooking-combo-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.combo-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.combo-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.combo-controls {
    display: flex;
    gap: 0.5rem;
}

.combo-controls select {
    padding: 0.4rem 0.6rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    border-radius: 4px;
    cursor: pointer;
}

.combo-controls select option {
    background: #1e3c72;
}

.combo-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 500px;
}

.combo-map-column {
    border-right: 1px solid #e0e0e0;
}

.combo-map {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

.combo-list-column {
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.combo-filters {
    padding: 0.8rem;
    border-bottom: 1px solid #e0e0e0;
}

.combo-search {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.combo-count {
    padding: 0.5rem 1rem;
    background: #e8f4ff;
    color: #1e3c72;
    font-size: 0.85rem;
    font-weight: 500;
}

.combo-hotels-list {
    flex: 1;
    overflow-y: auto;
    background: white;
}

.combo-hotels-items {
    display: flex;
    flex-direction: column;
}

.combo-hotel-item {
    padding: 0.8rem;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
}

.combo-hotel-item:hover,
.combo-hotel-item.selected {
    background: #f0f7ff;
    border-left: 3px solid #2a5298;
    padding-left: calc(0.8rem - 3px);
}

.combo-hotel-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.combo-hotel-header h4 {
    margin: 0;
    color: #1e3c72;
    font-size: 0.9rem;
    font-weight: 600;
}

.combo-hotel-rating {
    color: #f5a623;
    white-space: nowrap;
    font-size: 0.85rem;
}

.combo-hotel-address {
    margin: 0.2rem 0;
    color: #666;
    font-size: 0.8rem;
}

.combo-hotel-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    margin: 0.4rem 0;
}

.combo-distance {
    color: #2a5298;
}

.combo-price {
    color: #27ae60;
}

.combo-book-btn {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0.3rem 0.6rem;
    background: #2a5298;
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
}

.combo-book-btn:hover {
    background: #1e3c72;
}

.hotel-empty {
    padding: 2rem;
    text-align: center;
    color: #999;
}

/* Responsive */
@media (max-width: 1024px) {
    .combo-layout {
        grid-template-columns: 1fr;
    }

    .combo-map-column {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        min-height: 300px;
    }

    .combo-map {
        min-height: 300px;
    }
}

/* Leaflet Marker Cluster customization */
.marker-cluster {
    background-clip: padding-box;
    border-radius: 40px;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 15px;
    background: white;
    color: white;
    font-weight: bold;
    line-height: 30px;
}

.marker-cluster-small {
    background-color: rgba(42, 82, 152, 0.6);
}

.marker-cluster-small div {
    background-color: #2a5298;
}

.marker-cluster-medium {
    background-color: rgba(30, 60, 114, 0.6);
}

.marker-cluster-medium div {
    background-color: #1e3c72;
}

.marker-cluster-large {
    background-color: rgba(20, 40, 80, 0.6);
}

.marker-cluster-large div {
    background-color: #142850;
}

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-tip {
    background-color: white;
}

/* Hotel List - Desktop/Tablet Overlay */
.gpsbooking-hotel-list {
    position: absolute;
    top: 80px;
    right: 10px;
    width: 320px;
    max-height: calc(100% - 100px);
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    overflow: hidden;
    z-index: 400;
    display: flex;
    flex-direction: column;
}

.hotel-list-header {
    position: sticky;
    top: 0;
    background: white;
    padding: 15px;
    border-bottom: 2px solid #e0e0e0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hotel-list-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.hotel-list-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0;
    width: 24px;
    height: 24px;
}

.hotel-list-close:hover {
    color: #333;
}

.hotel-list-items {
    overflow-y: auto;
    flex: 1;
}

.hotel-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hotel-item:hover {
    background: #f8f8f8;
}

.hotel-item:active {
    background: #e8f4f8;
}

.hotel-item.active {
    background: #e8f4f8;
    border-left: 3px solid #007bff;
}

.hotel-info {
    flex: 1;
    padding-right: 10px;
}

.hotel-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.hotel-distance {
    font-size: 12px;
    color: #666;
}

.hotel-price {
    text-align: right;
    white-space: nowrap;
}

.price {
    font-size: 16px;
    font-weight: 700;
    color: #007bff;
}

.price-label {
    font-size: 11px;
    color: #999;
}

.hotel-list-empty {
    padding: 30px 15px;
    text-align: center;
    color: #999;
}

/* Responsive Mobile - Lista a destra */
@media (max-width: 767px) {
    .gpsbooking-map-container {
        display: flex;
        height: 100vh !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .gpsbooking-map {
        width: 50% !important;
        height: 100vh !important;
        border-radius: 0;
        margin: 0;
        flex-shrink: 0;
    }
    
    .gpsbooking-hotel-list {
        position: relative;
        top: 0;
        right: 0;
        width: 50%;
        height: 100vh;
        max-height: none;
        margin: 0;
        border-radius: 0;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        flex-shrink: 0;
    }
    
    .hotel-item {
        padding: 15px 12px;
    }
    
    .hotel-name {
        font-size: 13px;
    }
    
    .hotel-distance {
        font-size: 11px;
    }
    
    .price {
        font-size: 15px;
    }
}
}

/* Responsive map height for desktop */
@media (min-width: 768px) {
    .gpsbooking-map {
        height: 500px;
    }
}

/* Controls */
.gpsbooking-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
}

.gpsbooking-search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.gpsbooking-search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.gpsbooking-search-input::placeholder {
    color: #999;
}

.gpsbooking-btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.gpsbooking-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
    transform: translateY(-1px);
}

.gpsbooking-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 123, 255, 0.3);
}

.gpsbooking-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Status Messages */
.gpsbooking-status {
    padding: 12px 16px;
    margin-top: 10px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    display: none;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gpsbooking-status--info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.gpsbooking-status--loading {
    background: #e7f3ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.gpsbooking-status--success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.gpsbooking-status--warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.gpsbooking-status--error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.gpsbooking-status--loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid transparent;
    border-top-color: #004085;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

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

/* Popup Styling */
.gpsbooking-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 13px;
    color: #333;
}

.gpsbooking-name {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a1a;
    margin-bottom: 6px;
}

.gpsbooking-address {
    color: #555;
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 1.4;
}

.gpsbooking-distance {
    color: #28a745;
    font-weight: 500;
    margin-bottom: 4px;
}

.gpsbooking-phone {
    color: #666;
    margin-bottom: 4px;
    font-size: 12px;
}

.gpsbooking-popup a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.2s;
    display: inline-block;
    margin-top: 4px;
}

.gpsbooking-popup a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Leaflet custom styles */
.leaflet-popup-content {
    margin: 10px;
}

.leaflet-popup-close-button {
    color: #666;
}

.leaflet-popup-close-button:hover {
    color: #333;
}

/* Responsive controls */
@media (max-width: 480px) {
    .gpsbooking-controls {
        flex-direction: column;
        gap: 8px;
    }

    .gpsbooking-search-input {
        min-width: 100%;
    }

    .gpsbooking-btn {
        width: 100%;
    }
}

/* Accessibility */
.gpsbooking-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.gpsbooking-search-input:focus {
    outline: none;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .gpsbooking-controls {
        background: #2d2d2d;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    }

    .gpsbooking-search-input {
        background: #3d3d3d;
        border-color: #555;
        color: #fff;
    }

    .gpsbooking-search-input::placeholder {
        color: #aaa;
    }

    .gpsbooking-popup {
        color: #fff;
        background: #2d2d2d;
    }

    .gpsbooking-name {
        color: #fff;
    }

    .gpsbooking-address,
    .gpsbooking-phone {
        color: #ccc;
    }
}
