﻿/* public/css/matrix.css */

#scene-root.view-mode-matrix {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 140px);
}

.view-mode-matrix .scene-left-col,
.view-mode-matrix #side-inspector {
    display: none !important;
}

.view-mode-matrix #nexus-matrix-view {
    display: flex;
}

#nexus-matrix-view {
    display: none;
    width: 100%;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(11, 17, 29, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.nexus-matrix-view {
    --nexus-ok: #10b981;
    --nexus-warn: #f59e0b;
    --nexus-crit: #a855f7;
    --nexus-stroke: rgba(255, 255, 255, 0.08);
}

.nexus-matrix-inner {
    display: flex;
    gap: 16px;
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
}

.nexus-tower {
    flex: 1 1 360px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 14px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 20px 35px rgba(0, 0, 0, 0.45);
}

.nexus-tower-header {
    text-align: center;
    font-weight: 800;
    color: #e2e8f0;
    margin-bottom: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nexus-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nexus-floor {
    display: grid;
    gap: 6px;
    align-items: center;
}

.nexus-floor-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    width: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-weight: 700;
    font-size: 0.8rem;
}

.nexus-unit {
    position: relative;
    min-height: 26px;
    border-radius: 8px;
    border: 1px solid var(--nexus-stroke);
    background: rgba(12, 19, 31, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 0.02em;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.nexus-unit .nexus-unit-label {
    position: relative;
    z-index: 2;
}

.nexus-unit::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.4;
    z-index: 1;
}

.nexus-status-ok {
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(12, 19, 31, 0.9));
}
.nexus-status-warn {
    border-color: rgba(245, 158, 11, 0.65);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(12, 19, 31, 0.9));
}
.nexus-status-crit {
    border-color: rgba(168, 85, 247, 0.8);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(12, 19, 31, 0.9));
}
.nexus-unit:not(.nexus-status-ok):not(.nexus-status-warn):not(.nexus-status-crit) {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(12, 19, 31, 0.85);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

/* Responsividade: torres em colunas empilhadas no mobile */
@media (max-width: 1100px) {
    .nexus-matrix-inner {
        flex-direction: column;
    }
    .nexus-tower {
        flex: 1 1 100%;
        width: 100%;
    }
}

.nexus-alert-icon {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    font-weight: 900;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.nexus-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #94a3b8;
    padding: 14px 0;
}

.nexus-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    backdrop-filter: blur(6px);
}

.nexus-modal-overlay.open {
    display: flex;
}

.nexus-modal {
    width: min(900px, 90vw);
    max-height: 80vh;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nexus-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(15, 23, 42, 0.6));
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.nexus-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.nexus-modal-body {
    padding: 12px 18px 4px;
    overflow-y: auto;
    flex: 1;
}

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

.nexus-row {
    display: grid;
    grid-template-columns: auto 48px 1fr;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    align-items: center;
}

.nexus-row-crit {
    border-color: rgba(239, 68, 68, 0.5);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(15, 23, 42, 0.6));
}

.nexus-row-img {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.nexus-row-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #e2e8f0;
}

.nexus-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.nexus-row-mid {
    font-size: 0.85rem;
    color: #cbd5e1;
}

.nexus-row-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #cbd5e1;
}

.nexus-pill {
    background: rgba(148, 163, 184, 0.15);
    color: #e2e8f0;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.nexus-row-check {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nexus-row-check input {
    display: none;
}

.nexus-row-check .checkmark {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.nexus-row-check input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}

.nexus-row-check input:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: 800;
}

.text-danger {
    color: #ef4444;
}

.nexus-modal-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

@media (max-width: 1200px) {
    .nexus-matrix-inner {
        gap: 12px;
    }
    .nexus-tower {
        flex: 1 1 300px;
    }
}

@media (max-width: 768px) {
    .nexus-matrix-inner {
        flex-direction: column;
    }
    .nexus-tower {
        flex: 1 1 100%;
    }
    .nexus-floor {
        gap: 4px;
    }
    #nexus-matrix-view {
        padding: 12px;
    }
}
