/* ============================================
   AquaSentinel AI Intelligence Layer — Premium CSS
   YOLO-style detection overlays, evidence cards,
   confidence chips, ecosystem indicators
   ============================================ */

/* ---- AI Intelligence Section Header ---- */
.ai-section-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.ai-section-header i {
    font-size: 1.3rem;
    background: linear-gradient(135deg, #00f3ff, #0ea5e9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-section-header h3 {
    font-size: 1.1rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ---- Confidence Chip ---- */
.confidence-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 1px solid;
}

.confidence-chip.critical {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.confidence-chip.high {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
}

.confidence-chip.medium {
    background: rgba(14, 165, 233, 0.15);
    color: #0ea5e9;
    border-color: rgba(14, 165, 233, 0.3);
}

.confidence-chip.low {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
}

/* ---- AI Detection Card ---- */
.ai-detection-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.ai-detection-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #00f3ff, #0ea5e9);
    transition: width 0.3s ease;
}

.ai-detection-card:hover {
    background: rgba(0, 243, 255, 0.03);
    border-color: rgba(0, 243, 255, 0.2);
    transform: translateY(-1px);
}

.ai-detection-card:hover::before {
    width: 4px;
}

.ai-detection-card.severity-critical::before {
    background: linear-gradient(180deg, #ef4444, #dc2626);
}

.ai-detection-card.severity-high::before {
    background: linear-gradient(180deg, #f59e0b, #d97706);
}

.ai-detection-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid rgba(0, 243, 255, 0.15);
}

.ai-detection-content {
    flex: 1;
    min-width: 0;
}

.ai-detection-class {
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    text-transform: uppercase;
    margin-bottom: 0.15rem;
}

.ai-detection-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

/* ---- AI Evidence Panel ---- */
.ai-evidence-panel {
    background: rgba(0, 243, 255, 0.02);
    border: 1px solid rgba(0, 243, 255, 0.1);
    border-radius: 14px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.ai-evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.ai-evidence-stat {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.ai-evidence-stat .value {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #00f3ff, #0ea5e9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-evidence-stat .label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Pipeline Step Styles */
.pipeline-step {
    transition: all 0.3s ease;
    opacity: 0.6;
}

.pipeline-step.active {
    opacity: 1;
    transform: scale(1.1);
}

.pipeline-step.complete {
    opacity: 1;
}

.pipeline-step.failed {
    opacity: 1;
}

/* ---- Ecosystem Status Card ---- */
.eco-status-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
}

.eco-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.eco-status-dot.coral { background: #ff6b9d; box-shadow: 0 0 6px #ff6b9d; }
.eco-status-dot.algae { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.eco-status-dot.water { background: #0ea5e9; box-shadow: 0 0 6px #0ea5e9; }
.eco-status-dot.polluted { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.eco-status-dot.stressed { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }

/* ---- Confidence Gauge ---- */
.confidence-gauge {
    position: relative;
    width: 80px;
    height: 80px;
}

.confidence-gauge svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.confidence-gauge .value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.1rem;
    font-weight: 800;
}

/* ---- AI Detection Feed ---- */
.ai-feed-container {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 243, 255, 0.2) transparent;
}

.ai-feed-container::-webkit-scrollbar {
    width: 4px;
}

.ai-feed-container::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.3);
    border-radius: 2px;
}

/* ---- Map: YOLO-Style Detection Label ---- */
.ai-map-label {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 243, 255, 0.4);
    border-radius: 6px;
    padding: 4px 8px;
    font-family: 'Outfit', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #00f3ff;
    white-space: nowrap;
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.2);
    pointer-events: auto;
    cursor: pointer;
    line-height: 1.3;
}

.ai-map-label .label-class {
    color: #ffffff;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.ai-map-label .label-conf {
    color: #00f3ff;
    font-size: 10px;
    margin-left: 4px;
}

.ai-map-label.severity-critical {
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.ai-map-label.severity-critical .label-conf {
    color: #ef4444;
}

.ai-map-label.severity-high {
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.ai-map-label.severity-high .label-conf {
    color: #f59e0b;
}

/* ---- Map: Detection Zone Pulse ---- */
@keyframes detectionPulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

.ai-detection-zone-pulse {
    animation: detectionPulse 2.5s ease-in-out infinite;
}

/* ---- AI Upload Section ---- */
.ai-upload-zone {
    border: 2px dashed rgba(0, 243, 255, 0.3);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(0, 243, 255, 0.02);
}

.ai-upload-zone:hover {
    border-color: rgba(0, 243, 255, 0.5);
    background: rgba(0, 243, 255, 0.05);
}

.ai-upload-zone i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
    background: linear-gradient(135deg, #00f3ff, #0ea5e9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---- AI Progress Pipeline ---- */
.ai-pipeline-progress {
    display: flex;
    gap: 0;
    margin: 1.5rem 0;
}

.ai-pipeline-step {
    flex: 1;
    text-align: center;
    padding: 0.8rem 0.4rem;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 3px solid var(--border-color);
    transition: all 0.4s ease;
}

.ai-pipeline-step.active {
    color: #00f3ff;
    border-bottom-color: #00f3ff;
}

.ai-pipeline-step.complete {
    color: #22c55e;
    border-bottom-color: #22c55e;
}

/* ---- Detection Class Distribution Bar ---- */
.class-dist-bar {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    margin-top: 0.5rem;
}

.class-dist-segment {
    transition: width 0.6s ease;
}

.class-dist-segment.plastic { background: #3b82f6; }
.class-dist-segment.ghost_net { background: #8b5cf6; }
.class-dist-segment.floating { background: #06b6d4; }
.class-dist-segment.oil { background: #ef4444; }
.class-dist-segment.algae { background: #22c55e; }
.class-dist-segment.unknown { background: #6b7280; }
