/**
 * Styles for MapLibre Warning Control
 * Similar to zoom extent and legend controls
 */

/* Warning Control Button - Similar cu .map_btn (togglePoiModeBtn) */
.maplibregl-ctrl-warning {
    background-color: #fff !important;
    background-image: none !important;
    border: 0 !important;
    padding: 8px !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.maplibregl-ctrl-warning:hover {
    background-color: #ffc107 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    transform: translateY(-2px) !important;
}

.maplibregl-ctrl-warning i {
    font-size: 18px !important;
    color: #dc3545 !important;
}

.maplibregl-ctrl-warning:hover i {
    color: #fff !important;
}

/* Warning Marker on Map */
.warning-marker {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #dc3545;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 3px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    cursor: move;
    transition: all 0.2s ease;
}

.warning-marker:hover {
    transform: rotate(-45deg) scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.warning-marker i {
    font-size: 20px;
    color: #fff;
    transform: rotate(45deg);
}

/* Map Placement Instructions - Positioned in map container */
.map-placement-instructions {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: #ffc107;
    color: #000;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    display: none !important;
    font-weight: 500;
    font-size: 0.85rem;
}

.map-placement-instructions.show {
    display: flex !important;
    align-items: center;
    gap: 0.4rem;
    animation: slideUpInMap 0.3s ease;
}

.map-placement-instructions i {
    font-size: 0.95rem;
}

.map-placement-instructions button {
    background: transparent;
    border: none;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    margin-left: 0.3rem;
    font-size: 0.9rem;
}

.map-placement-instructions button:hover {
    opacity: 0.7;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideUpInMap {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Location Info in Modal */
#locationInfo {
    margin-top: 1rem;
}

#locationInfo .alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Responsive */
@media (max-width: 768px) {
    .map-placement-instructions {
        left: 10px;
        right: 10px;
        transform: none;
        width: auto;
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .map-placement-instructions i {
        font-size: 0.85rem;
    }
    
    .modal-minimized-indicator {
        left: 10px;
        right: 10px;
        transform: none;
        width: auto;
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .modal-minimized-indicator i {
        font-size: 0.85rem;
    }
    
    .warning-marker {
        width: 35px;
        height: 35px;
    }
    
    .warning-marker i {
        font-size: 18px;
    }
}

/* Cursor when placing marker */
.maplibregl-canvas-container.placing-marker {
    cursor: crosshair !important;
}

/* Modal minimized state */
.modal.modal-minimized {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.modal-minimized .modal-dialog {
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

/* Ascunde backdrop când e setat display: none */
.modal-backdrop[style*="display: none"] {
    pointer-events: none !important;
}

/* Mini floating indicator când modalul e minimizat - Positioned in map container */
.modal-minimized-indicator {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: #ffc107;
    color: #000;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    display: none !important;
    font-weight: 500;
    font-size: 0.85rem;
}

.modal-minimized-indicator.show {
    display: flex !important;
    align-items: center;
    gap: 0.4rem;
    animation: slideUpInMap 0.3s ease;
}

.modal-minimized-indicator i {
    font-size: 0.95rem;
}

.modal-minimized-indicator button {
    background: transparent;
    border: none;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    margin-left: 0.3rem;
    font-size: 0.9rem;
}

.modal-minimized-indicator button:hover {
    opacity: 0.7;
}

/* Existing warning markers (approved warnings on map) */
.existing-warning-marker {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.existing-warning-marker:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.existing-warning-marker i {
    font-size: 16px;
    color: #fff;
}

/* Severity colors for existing warnings */
.existing-warning-marker.severity-low {
    background-color: #28a745;
}

.existing-warning-marker.severity-medium {
    background-color: #ffc107;
}

.existing-warning-marker.severity-high {
    background-color: #fd7e14;
}

.existing-warning-marker.severity-critical {
    background-color: #dc3545;
}

/* Warning popup */
.maplibregl-popup-content.warning-popup {
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    min-width: 250px;
}

.warning-popup-header {
    padding: 0.75rem 1rem;
    color: #fff;
    font-weight: 600;
}

.warning-popup-body {
    padding: 1rem;
}

.warning-popup-severity-low {
    background-color: #28a745;
}

.warning-popup-severity-medium {
    background-color: #ffc107;
}

.warning-popup-severity-high {
    background-color: #fd7e14;
}

.warning-popup-severity-critical {
    background-color: #dc3545;
}

/* Warning icon with dynamic color (used in layer switcher markers) */
.warning-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--warning-color, #ffc107);
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.warning-icon:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.warning-icon i {
    font-size: 16px;
    color: #fff;
}

/* Warning popup card styles */
.warning-popup .maplibregl-popup-content {
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    min-width: 280px;
    max-width: 350px;
}

.warning-popup-card {
    background: #fff;
}

.warning-popup-card .warning-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
}

.warning-popup-card .warning-icon-container {
    flex-shrink: 0;
}

.warning-popup-card .warning-title-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.warning-popup-card .warning-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
    color: #333;
}

.warning-popup-card .warning-body {
    border-top: 1px solid #eee;
}

.warning-popup-card .warning-description {
    color: #555;
}

.warning-popup-card .warning-meta {
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.warning-popup-card .warning-image img {
    max-height: 150px;
    object-fit: cover;
}

@media (max-width: 768px) {
    .maplibregl-popup-content.warning-popup,
    .warning-popup .maplibregl-popup-content {
        width: calc(100vw - 24px);
        min-width: 0;
        max-width: 320px;
    }

    .warning-popup-card .warning-header {
        padding: 10px 12px;
        gap: 8px;
    }

    .warning-popup-card .warning-title {
        font-size: 14px;
    }

    .warning-popup-card .warning-body {
        padding: 0.85rem 1rem;
    }

    .warning-popup-card .warning-description,
    .warning-popup-card .warning-meta {
        font-size: 12px;
        line-height: 1.35;
    }

    .warning-popup-card .warning-image img {
        max-height: 120px;
        width: 100%;
    }

    .maplibregl-popup-close-button {
        width: 32px;
        height: 32px;
        font-size: 20px;
        line-height: 28px;
    }
}

@media (max-width: 480px) {
    .maplibregl-popup-content.warning-popup,
    .warning-popup .maplibregl-popup-content {
        width: calc(100vw - 14px);
        max-width: 280px;
    }

    .warning-popup-card .warning-header {
        padding: 8px 10px;
        gap: 6px;
    }

    .warning-popup-card .warning-title {
        font-size: 13px;
    }

    .warning-popup-card .warning-body {
        padding: 0.75rem 0.85rem;
    }

    .warning-popup-card .warning-image img {
        max-height: 100px;
    }

    .maplibregl-popup-close-button {
        width: 30px;
        height: 30px;
        font-size: 18px;
        line-height: 26px;
    }
}

/* Layer switcher warning section */
.warnings-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #dc3545;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.warnings-section h4::before {
    content: "⚠️";
    font-size: 14px;
}

.warning-layer-checkbox:checked + .layers-checkbox-image {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}
