/**
 * Frontend map styles
 */

/* Inter font */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../../fonts/Inter-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../../fonts/Inter-Medium.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../../fonts/Inter-SemiBold.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../../fonts/Inter-Bold.woff2') format('woff2');
}

/* Container */
.lr-map-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.lr-map-container,
.lr-map-container *:not(svg *) {
    font-family: var(--wp--preset--font-family--body, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
}

/* Controls */
.lr-map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.lr-map-controls button {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    border: 1px solid #ccc !important;
    background: #fff !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 18px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.2s !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #333 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-weight: 400 !important;
    outline: none !important;
    box-sizing: border-box !important;
    float: none !important;
}

.lr-map-controls button:hover {
    background: #f0f0f0 !important;
    color: #000 !important;
}

/* Map wrapper */
.lr-map-wrapper {
    position: relative;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f5f5f5;
}

/* SVG Map */
.lr-map {
    display: block;
    width: 100%;
    height: auto;
    min-height: 500px;
    max-height: 80vh;
    cursor: grab;
}

.lr-map.lr-dragging {
    cursor: grabbing;
}

/* Vakken */
.lr-vak {
    fill: rgba(76, 175, 80, 0.5);
    stroke: #4CAF50;
    stroke-width: 2;
    cursor: pointer;
    transition: fill 0.2s, stroke 0.2s;
}

/* State: Available */
.lr-state-available {
    fill: rgba(76, 175, 80, 0.5);
    stroke: #4CAF50;
}

.lr-state-available:hover {
    fill: rgba(76, 175, 80, 0.7);
}

/* State: Held by me (in my cart) */
.lr-state-held-by-me {
    fill: rgba(33, 150, 243, 0.5);
    stroke: #2196F3;
    cursor: pointer;
}

.lr-state-held-by-me:hover {
    fill: rgba(33, 150, 243, 0.7);
}

/* State: Held (by someone else) */
.lr-state-held {
    fill: rgba(255, 152, 0, 0.5);
    stroke: #FF9800;
    cursor: not-allowed;
}

.lr-state-held:hover {
    fill: rgba(255, 152, 0, 0.7);
}

/* State: Sold */
.lr-state-sold {
    fill: rgba(244, 67, 54, 0.5);
    stroke: #F44336;
    cursor: not-allowed;
}

.lr-state-sold:hover {
    fill: rgba(244, 67, 54, 0.7);
}

/* State: Sold by me (my order) */
.lr-state-sold-by-me {
    fill: rgba(156, 39, 176, 0.5);
    stroke: #9C27B0;
    cursor: not-allowed;
}

.lr-state-sold-by-me:hover {
    fill: rgba(156, 39, 176, 0.7);
}

/* State: Disabled */
.lr-state-disabled {
    fill: rgba(158, 158, 158, 0.5);
    stroke: #9E9E9E;
    cursor: not-allowed;
}

.lr-state-disabled:hover {
    fill: rgba(158, 158, 158, 0.7);
}

/* Vak labels */
.lr-vak-label {
    font-size: 12px;
    font-weight: 600;
    fill: #333;
    pointer-events: none;
    user-select: none;
}

/* Legend */
.lr-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.lr-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lr-legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

.lr-legend-color.lr-state-available {
    background: rgba(76, 175, 80, 0.5);
    border: 2px solid #4CAF50;
}

.lr-legend-color.lr-state-held-by-me {
    background: rgba(33, 150, 243, 0.5);
    border: 2px solid #2196F3;
}

.lr-legend-color.lr-state-held {
    background: rgba(255, 152, 0, 0.5);
    border: 2px solid #FF9800;
}

.lr-legend-color.lr-state-sold {
    background: rgba(244, 67, 54, 0.5);
    border: 2px solid #F44336;
}

.lr-legend-color.lr-state-sold-by-me {
    background: rgba(156, 39, 176, 0.5);
    border: 2px solid #9C27B0;
}

.lr-legend-label {
    font-size: 14px;
    color: #333;
}

/* Tooltip */
.lr-vak-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
}

.lr-tooltip-label {
    font-weight: 600;
    margin-right: 8px;
}

.lr-tooltip-status {
    opacity: 0.9;
}

/* Error message */
.lr-error {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
}

/* Loading state */
.lr-map-container.lr-loading {
    opacity: 0.7;
    pointer-events: none;
}

.lr-map-container.lr-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #ddd;
    border-top-color: #2196F3;
    border-radius: 50%;
    animation: lr-spin 0.8s linear infinite;
}

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

/* Modal */
.lr-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Hidden attribute support */
.lr-modal[hidden],
.lr-vak-tooltip[hidden],
.lr-options-loading[hidden],
.lr-options-container[hidden],
.lr-extra-options-container[hidden],
.lr-note-container[hidden],
.lr-no-options[hidden] {
    display: none !important;
}

.lr-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.lr-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    font-family: var(--wp--preset--font-family--body, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
}

.lr-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 5px;
}

.lr-modal-close:hover {
    color: #333;
}

.lr-modal-title {
    margin: 0;
    padding: 20px 20px 15px;
    font-size: 20px;
    border-bottom: 1px solid #eee;
}

.lr-modal-vak-label {
    color: #2196F3;
}

.lr-modal-body {
    padding: 20px;
}

.lr-options-loading {
    text-align: center;
    color: #666;
    padding: 20px;
}

.lr-options-intro {
    margin: 0 0 15px 0;
    font-weight: 500;
}

.lr-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lr-option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.lr-option-item:hover {
    border-color: #2196F3;
    background: #f5f9ff;
}

.lr-option-item.lr-selected {
    border-color: #2196F3;
    background: #e3f2fd;
}

.lr-option-item input[type="radio"],
.lr-option-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
}

.lr-option-info {
    flex: 1;
}

.lr-option-name {
    font-weight: 500;
    font-size: 15px;
}

.lr-option-price {
    font-weight: 600;
    color: #4CAF50;
    font-size: 16px;
}

.lr-extra-options-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.lr-extra-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lr-note-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.lr-note-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

.lr-note-required-hint {
    color: #999;
    font-weight: 400;
}

.lr-note-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.lr-note-textarea:focus {
    border-color: #4CAF50;
    outline: none;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}

.lr-total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #eee;
    font-size: 18px;
}

.lr-total-label {
    font-weight: 500;
}

.lr-total-amount {
    font-weight: 700;
    color: #4CAF50;
    font-size: 22px;
}

.lr-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 15px 20px 20px;
    border-top: 1px solid #eee;
}

.lr-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.lr-btn-primary {
    background: #4CAF50;
    color: #fff;
}

.lr-btn-primary:hover {
    background: #43a047;
}

.lr-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.lr-btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.lr-btn-secondary:hover {
    background: #d0d0d0;
}

.lr-no-options {
    text-align: center;
    color: #666;
    padding: 10px;
}

/* Fullscreen mode */
.lr-map-container.lr-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    z-index: 9999 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #f5f5f5 !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

.lr-map-container.lr-fullscreen .lr-map-wrapper {
    flex: 1 !important;
    border: none !important;
    border-radius: 0 !important;
    min-height: 0 !important;
}

.lr-map-container.lr-fullscreen .lr-map {
    max-height: none !important;
    height: 100% !important;
    width: 100% !important;
}

.lr-map-container.lr-fullscreen .lr-map-controls {
    top: 15px;
    right: 15px;
    z-index: 20;
}

.lr-map-container.lr-fullscreen .lr-map-legend {
    border-radius: 0;
    margin-top: 0;
    border-top: 1px solid #ddd;
    flex-shrink: 0;
}

.lr-fullscreen-close-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.lr-map-container.lr-fullscreen .lr-fullscreen-close-bar {
    display: flex;
}

.lr-fullscreen-close-bar-title {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.lr-fullscreen-close-btn {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background: #e0e0e0 !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 8px 16px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    color: #333 !important;
}

.lr-fullscreen-close-btn:hover {
    background: #d0d0d0 !important;
}

/* Responsive */
@media (max-width: 600px) {
    .lr-map-wrapper {
        min-height: 300px;
    }

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

    .lr-map-controls button {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        max-width: 44px !important;
        max-height: 44px !important;
        font-size: 22px !important;
    }

    .lr-map-legend {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px 12px;
        padding: 8px 10px;
        font-size: 12px;
    }

    .lr-legend-color {
        width: 14px;
        height: 14px;
    }

    .lr-legend-label {
        font-size: 12px;
    }

    .lr-modal {
        padding: 10px;
    }

    .lr-modal-footer {
        flex-direction: column;
    }

    .lr-modal-footer .lr-btn {
        width: 100%;
    }

    .lr-vak-label {
        font-size: 10px;
    }
}

@media (max-width: 400px) {
    .lr-map-legend {
        gap: 4px 10px;
        padding: 6px 8px;
    }

    .lr-legend-label {
        font-size: 11px;
    }
}
