/* Estilos para Ocorrências (Admin) */

/*
 * O shell carrega companhias-styles.css antes deste ficheiro. Lá, .company-details
 * usa display:grid com duas colunas (1fr 1fr). Nos detalhes da ocorrência o markup
 * é <div class="company-details occurrence-details"> com um único filho — a segunda
 * coluna da grelha fica vazia (~metade do modal). Forçamos bloco em largura total.
 */
.company-details.occurrence-details {
    display: block;
    width: 100%;
    max-width: 100%;
}

.priority-badge{ padding:4px 10px; border-radius:12px; font-size:12px; font-weight:600; }
.priority-baixa{ background:#DBEAFE; color:#1E40AF; }
.priority-media{ background:#FEF3C7; color:#D97706; }
.priority-alta{ background:#FEE2E2; color:#DC2626; }
.priority-critica{ background:#FEE2E2; color:#B91C1C; border:1px solid #B91C1C; }

.status-pendente{ background:#FEF3C7; color:#D97706; }
.status-em_processamento{ background:#DBEAFE; color:#1E40AF; }
.status-fechado{ background:#DCFCE7; color:#16A34A; }
.status-cancelado{ background:#F3F4F6; color:#6B7280; }

.action-buttons{ display:flex; gap:8px; flex-wrap:wrap; }
.action-buttons .btn{ padding:6px 10px; font-size:12px; }

/* ====== DARK MODE - Ocorrências ====== */
body[data-theme="dark"] .priority-baixa { background: #0c2340 !important; color: #93c5fd !important; }
body[data-theme="dark"] .priority-media { background: #2d1f0c !important; color: #fbbf24 !important; }
body[data-theme="dark"] .priority-alta { background: #2d0c0c !important; color: #fca5a5 !important; }
body[data-theme="dark"] .priority-critica { background: #2d0c0c !important; color: #f87171 !important; border-color: #f87171 !important; }

body[data-theme="dark"] .status-pendente { background: #2d1f0c !important; color: #fbbf24 !important; }
body[data-theme="dark"] .status-em_processamento { background: #0c2340 !important; color: #93c5fd !important; }
body[data-theme="dark"] .status-fechado { background: #0c2d18 !important; color: #6ee7b7 !important; }
body[data-theme="dark"] .status-cancelado { background: #2a2929 !important; color: #aaaaaa !important; }

/* Estilos para grupos de detalhes organizados */
.occurrence-details .detail-group {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    border-left: 4px solid #007bff;
}

.occurrence-details .company-detail-item {
    margin-bottom: 8px;
    padding: 4px 0;
}

.occurrence-details .company-detail-item:last-child {
    margin-bottom: 0;
}

.occurrence-details .company-detail-item label {
    margin-bottom: 3px;
    font-size: 11px;
}

.occurrence-details .company-detail-item .value {
    font-size: 13px;
    line-height: 1.4;
}

.occurrence-details .detail-group.detail-group-primary {
    background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
    border-left-color: #007bff;
    border-left-width: 5px;
}

.occurrence-details .detail-group.equipment-info {
    background: linear-gradient(135deg, #e0f2fe 0%, #ffffff 100%);
    border-left-color: #0ea5e9;
}

.occurrence-details .detail-group h4 {
    color: #1F2937;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e5e7eb;
}

.occurrence-details .detail-group h4 i {
    margin-right: 10px;
    color: #007bff;
}

.occurrence-details .detail-group.equipment-info h4 {
    color: #0c4a6e;
}

.occurrence-details .detail-group.equipment-info h4 i {
    color: #0ea5e9;
}

.occurrence-details .detail-separator {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e5e7eb 20%, #020e25 80%, transparent);
    margin: 10px 0;
    position: relative;
}

.occurrence-details .detail-separator::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #007bff;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.1);
}

/* Modo Escuro - Grupos de Detalhes */
body[data-theme="dark"] .occurrence-details .detail-group {
    background: linear-gradient(135deg, #242323 0%, #1d1e20 100%) !important;
    border-left-color: #3b82f6 !important;
}

body[data-theme="dark"] .occurrence-details .detail-group.detail-group-primary {
    background: linear-gradient(135deg, #1e3a5f 0%, #242323 100%) !important;
    border-left-color: #3b82f6 !important;
    border-left-width: 5px;
}

body[data-theme="dark"] .occurrence-details .detail-group.equipment-info {
    background: linear-gradient(135deg, #1e3a5f 0%, #242323 100%) !important;
    border-left-color: #0ea5e9 !important;
}

body[data-theme="dark"] .occurrence-details .detail-group h4 {
    color: #E5E7EB !important;
    border-bottom-color: #3d4045 !important;
}

body[data-theme="dark"] .occurrence-details .detail-group h4 i {
    color: #60A5FA !important;
}

body[data-theme="dark"] .occurrence-details .detail-group.equipment-info h4 {
    color: #E5E7EB !important;
}

body[data-theme="dark"] .occurrence-details .detail-group.equipment-info h4 i {
    color: #0ea5e9 !important;
}

body[data-theme="dark"] .occurrence-details .detail-separator {
    background: linear-gradient(90deg, transparent, #3d4045 20%, #3d4045 80%, transparent) !important;
}
body[data-theme="dark"] .solucao-final {
    background-color: #191b1f !important;
    color: #e4e4e4 !important;
    border-color: #3a3939 !important;
}

body[data-theme="dark"] .occurrence-details .detail-separator::before {
    background: #3b82f6 !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2) !important;
}

/* Grelha de dois blocos para campos dentro de cada secção (ex.: Informações essenciais) */
.occurrence-details .detail-items-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 28px;
    width: 100%;
    align-items: start;
}

.occurrence-details .detail-items-grid .company-detail-item {
    margin-bottom: 0;
    padding: 6px 0;
    min-width: 0;
}

.occurrence-details .detail-items-grid .company-detail-item.full-width {
    grid-column: 1 / -1;
}

@media (max-width: 720px) {
    .occurrence-details .detail-items-grid {
        grid-template-columns: 1fr;
    }
}

/* Layout de duas colunas para detalhes (coluna esquerda / direita do modal) */
.occurrence-details .details-two-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr);
    gap: 8px 28px;
    align-items: start;
    height: fit-content;
    min-height: 0;
    width: 100%;
    grid-auto-rows: min-content;
}

.occurrence-details .details-two-columns.single-column {
    grid-template-columns: 1fr;
    gap: 0;
}

.occurrence-details .details-column-divider {
    width: 1px;
    background: linear-gradient(to bottom, transparent, #e5e7eb 5%, #e5e7eb 95%, transparent);
    margin: 0 15px;
    grid-row: 1 / -1;
    height: 100%;
    min-height: 0;
    align-self: stretch;
}

.occurrence-details .details-column-left,
.occurrence-details .details-column-right {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    height: fit-content;
    min-height: 0;
    align-items: stretch;
    width: 100%;
}

.occurrence-details .details-column-left .detail-group,
.occurrence-details .details-column-right .detail-group {
    margin-bottom: 15px;
}

.occurrence-details .details-column-left .detail-separator,
.occurrence-details .details-column-right .detail-separator {
    margin: 12px 0;
}

/* Modo Escuro - Divisor */
body[data-theme="dark"] .occurrence-details .details-column-divider {
    background: linear-gradient(to bottom, transparent, #3d4045 5%, #3d4045 95%, transparent);
}

/* Responsividade - em telas menores, colunas esquerda/direita empilhadas */
@media (max-width: 1200px) {
    .occurrence-details .details-two-columns:not(.single-column) {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .occurrence-details .details-column-divider {
        display: none;
    }
}

/* Modal de detalhes: ocupar melhor o ecrã (complementa estilos na página injectada) */
#detailsModal .modal-content.modal-large {
    width: min(1520px, 97vw);
    max-width: 97vw;
    min-height: min(780px, 90vh);
    max-height: 94vh;
}

#detailsModal .modal-body {
    min-height: min(520px, 70vh);
}