/**
 * LogIX Map Leaflet Custom Styles
 * Mobile-first, dark theme styling for location markers with status colors
 */

/* ===== Map Page Container ===== */
.logix-map-page {
    position: relative;
    width: 100%;
    height: 100%;
}

/* ===== Map Container ===== */
#logix-map-container {
    width: 100%;
    height: 100%;
    background: #1a1a2e;
    z-index: 1;
}

/* ===== Individual Markers ===== */
.logix-marker-container {
    background: transparent !important;
    border: none !important;
}

.logix-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    color: #ffffff;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.logix-marker:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.logix-marker-small {
    width: 28px;
    height: 28px;
    font-size: 10px;
}

.logix-marker-medium {
    width: 34px;
    height: 34px;
    font-size: 11px;
}

.logix-marker-large {
    width: 40px;
    height: 40px;
    font-size: 12px;
}

/* Pulse animation for overdue markers */
.logix-marker.pulse,
.logix-cluster.pulse {
    animation: pulse-animation 1.5s ease-in-out infinite;
}

@keyframes pulse-animation {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* ===== Cluster Icons ===== */
.logix-cluster-container {
    background: transparent !important;
    border: none !important;
}

.logix-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.logix-cluster:hover {
    transform: scale(1.1);
}

.logix-cluster-small {
    width: 30px;
    height: 30px;
    font-size: 11px;
}

.logix-cluster-medium {
    width: 40px;
    height: 40px;
    font-size: 13px;
}

.logix-cluster-large {
    width: 50px;
    height: 50px;
    font-size: 14px;
}

/* ===== Popup Styles ===== */
.logix-popup {
    min-width: 180px;
}

.popup-name {
    font-weight: 600;
    font-size: 16px;
    color: #ffffff;
    margin-bottom: 4px;
    line-height: 1.3;
}

.popup-description {
    font-size: 12px;
    color: #a0aec0;
    margin-bottom: 8px;
    line-height: 1.4;
}

.popup-status {
    font-size: 13px;
    margin-bottom: 6px;
    padding: 6px 0;
    border-top: 1px solid #2d3a5a;
    border-bottom: 1px solid #2d3a5a;
}

.popup-logs {
    font-size: 12px;
    color: #60a5fa;
    margin-bottom: 10px;
}

.popup-btn {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    min-height: 44px;
}

.popup-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.popup-btn:active {
    transform: scale(0.98);
}

/* ===== Status Bar ===== */
.map-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    font-size: 14px;
    border-bottom: 1px solid #2d3a5a;
    min-height: 44px;
}

.status-text {
    color: #4ade80;
}

.status-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fbbf24;
}

.status-loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #fbbf24;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.status-count {
    color: #60a5fa;
    font-weight: 600;
}

/* ===== Control Buttons ===== */
.map-controls {
    position: absolute;
    top: 70px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-control-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid #2d3a5a;
    background: rgba(26, 26, 46, 0.95);
    color: #e0e0e0;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.map-control-btn:hover {
    background: rgba(45, 58, 90, 0.95);
}

.map-control-btn:active {
    transform: scale(0.95);
}

/* ===== Legend ===== */
.map-legend {
    position: absolute;
    bottom: 80px;
    right: 10px;
    background: rgba(26, 26, 46, 0.95);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #2d3a5a;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: #a0aec0;
    font-size: 11px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    flex-shrink: 0;
}

.legend-marker.status-green {
    background: #34d399;
}

.legend-marker.status-yellow {
    background: #f97316;
}

.legend-marker.status-red {
    background: #ef4444;
}

.legend-marker.status-overdue {
    background: #ef4444;
    animation: pulse-animation 1.5s ease-in-out infinite;
}

/* ===== Instructions ===== */
.map-instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 46, 0.95);
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid #2d3a5a;
    color: #a0aec0;
    font-size: 12px;
    z-index: 1000;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .map-status-bar {
        padding: 8px 12px;
        font-size: 12px;
        flex-wrap: wrap;
        gap: 4px;
    }

    .map-legend {
        bottom: 70px;
        right: 8px;
        padding: 8px 10px;
    }

    .legend-item {
        font-size: 10px;
    }

    .map-instructions {
        bottom: 15px;
        padding: 8px 16px;
        font-size: 11px;
        max-width: 80%;
    }

    .popup-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .map-controls {
        top: 60px;
        right: 8px;
    }

    /* Larger touch targets on mobile */
    .logix-marker-small {
        width: 32px;
        height: 32px;
    }

    .logix-marker-medium {
        width: 38px;
        height: 38px;
    }

    .logix-marker-large {
        width: 44px;
        height: 44px;
    }

    .logix-cluster-small {
        width: 36px;
        height: 36px;
    }

    .logix-cluster-medium {
        width: 46px;
        height: 46px;
    }

    .logix-cluster-large {
        width: 56px;
        height: 56px;
    }
}

/* ===== Hide default cluster styles ===== */
.marker-cluster {
    background: transparent !important;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: transparent !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: transparent !important;
}
