/*
 * Plant status markers on the home map.
 *
 * These must be GLOBAL (not scoped component CSS): Leaflet builds the marker element
 * itself via L.divIcon, so it never carries a Blazor scope attribute.
 *
 * Referenced from Pages/_Host.cshtml.
 */

.plant-marker {
    /* Leaflet's default .leaflet-div-icon paints a white box + border. */
    background: transparent !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .plant-marker .marker-dot {
        width: 13px;
        height: 13px;
        border-radius: 50%;
        background: currentColor;
        border: 2px solid rgba(255, 255, 255, 0.9);
        /* currentColor lets one rule serve every status; only the colour changes below. */
        box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.28), 0 0 10px 2px currentColor;
        transition: transform 0.15s ease;
    }

    .plant-marker:hover .marker-dot {
        transform: scale(1.25);
    }

/* Bốn màu này PHẢI khớp PlantStatusEvaluator.ColorOf (Service/Home/PlantStatusEvaluator.cs).
   Marker do Leaflet dựng trong JS nên không nhận được style inline như chú giải và donut —
   đây là bản sao duy nhất còn lại, đổi màu ở evaluator thì sửa luôn ở đây. */
.plant-marker--normal {
    color: #22c55e;
}

.plant-marker--warning {
    color: #f5b301;
}

.plant-marker--critical {
    color: #ef4444;
}

.plant-marker--offline {
    color: #9ca3af;
}

/* ---------- Plant detail popup ----------
   Also global: Leaflet owns the popup DOM. Deliberately dark in both themes, because
   the popup floats over a dark map tile either way. */

.plant-popup .leaflet-popup-content-wrapper {
    background: #1b1f24;
    color: #e8eaed;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

.plant-popup .leaflet-popup-tip {
    background: #1b1f24;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.plant-popup .leaflet-popup-content {
    margin: 14px 16px;
    font-family: 'Poppins', sans-serif;
}

.plant-popup a.leaflet-popup-close-button {
    color: #9aa0a6;
}

.pp-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}

.pp-capacity {
    font-size: 13px;
    color: #9aa0a6;
    margin-bottom: 10px;
}

.pp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 3px 0;
    font-size: 13px;
}

.pp-label {
    color: #c7c9cc;
}

.pp-value {
    font-weight: 700;
    color: #7ed957;
    white-space: nowrap;
}

/* Dòng Alarm chỉ đỏ khi số lượng > 0; bằng 0 thì dùng màu xanh mặc định của .pp-value.
   Lớp này được MapComponent.BuildPopupHtml gắn có điều kiện. */
.pp-value--alarm {
    color: #ef4444;
}

/* Hai nút ở chân thẻ: Xem chi tiết bên trái, Camera bên phải.
   Đường kẻ ngăn nằm ở đây chứ không phải trên từng nút, nếu không sẽ thành hai đoạn kẻ rời. */
.pp-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

a.popup-view-details,
button.popup-camera-details {
    color: #6aa9ff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

    a.popup-view-details:hover,
    button.popup-camera-details:hover {
        color: #8fc0ff;
        text-decoration: underline;
    }

/* MudBlazor đặt `button { justify-content: center }` và trình duyệt tự thêm nền/viền —
   phải reset, nếu không nút Camera sẽ ra hình khối xám chứ không phải chữ như nút bên trái. */
button.popup-camera-details {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    line-height: inherit;
    cursor: pointer;
}

/* Only faults pulse — a map where everything blinks reads as noise. */
.plant-marker--critical .marker-dot {
    animation: plant-marker-pulse 1.5s ease-out infinite;
}

@keyframes plant-marker-pulse {
    0% {
        box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.28), 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.28), 0 0 0 12px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.28), 0 0 0 0 rgba(239, 68, 68, 0);
    }
}
