/* Estilos para tabelas - Dashboard SSMA */

.table-container {
    background: var(--cor-bg-card);
    border: 1px solid var(--cor-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Header da tabela */
.table-header-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--cor-border);
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.table-header-section h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.table-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Controles */
.search-control {
    position: relative;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid var(--cor-border);
    border-radius: 4px;
    font-size: 13px;
    width: 250px;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--cor-info);
    box-shadow: 0 0 0 2px rgba(23, 162, 184, 0.2);
}

.severity-filter select,
.page-size-control select {
    padding: 8px 12px;
    border: 1px solid var(--cor-border);
    border-radius: 4px;
    font-size: 13px;
    background: white;
    cursor: pointer;
}

.severity-filter select:focus,
.page-size-control select:focus {
    outline: none;
    border-color: var(--cor-info);
}

/* Tabela responsiva */
.table-responsive {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.ros-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.4;
}

/* Header da tabela */
.ros-table thead th {
    background: #f1f3f4;
    color: #5f6368;
    font-weight: 600;
    padding: 12px 8px;
    text-align: left;
    border-bottom: 2px solid var(--cor-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.ros-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.ros-table thead th.sortable:hover {
    background: #e8eaed;
}

.ros-table thead th.sorted-asc,
.ros-table thead th.sorted-desc {
    background: #e1f5fe;
    color: var(--cor-info);
}

.sort-icon {
    font-size: 12px;
    opacity: 0.5;
    margin-left: 4px;
}

.sort-icon.active {
    opacity: 1;
    color: var(--cor-info);
}

/* Corpo da tabela */
.ros-table tbody td {
    padding: 12px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.ros-table tbody tr {
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.ros-table tbody tr:hover {
    background-color: #f8f9fa;
}

.ros-table tbody tr.selected {
    background-color: #e3f2fd;
    border-left: 4px solid var(--cor-info);
}

.ros-table tbody tr.highlighted {
    background-color: #fff3cd;
    border-left: 4px solid var(--cor-medio);
    animation: highlight-fade 3s ease-out;
}

@keyframes highlight-fade {
    0% { background-color: #ffeaa7; }
    100% { background-color: #fff3cd; }
}

/* Estados das linhas */
.ros-table tbody tr.row-overdue {
    background-color: #fff5f5;
    border-left: 3px solid var(--cor-alerta);
}

.ros-table tbody tr.row-high-priority {
    font-weight: 500;
}

.ros-table tbody tr.row-overdue.row-high-priority {
    background-color: #ffebee;
    border-left: 4px solid var(--cor-severo);
}

/* Células específicas */
.id-cell {
    font-weight: 600;
    color: var(--cor-info);
}

.ros-id {
    font-family: 'Courier New', monospace;
    display: block;
    font-size: 14px;
}

.cod-acao {
    color: var(--cor-texto-secundario);
    font-size: 11px;
    display: block;
    margin-top: 2px;
}

.desc-cell {
    max-width: 300px;
}

.desc-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.desc-text {
    line-height: 1.3;
}

.gmr-tag {
    font-size: 11px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-block;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.responsible-cell {
    max-width: 150px;
}

.responsible-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.responsible-name {
    font-weight: 500;
}

.ger-info {
    font-size: 11px;
    color: #6c757d;
}

.date-cell {
    white-space: nowrap;
}

.date-info {
    display: flex;
    align-items: center;
    gap: 4px;
}

.date-value.overdue {
    color: var(--cor-alerta);
    font-weight: 600;
}

.overdue-icon {
    font-size: 12px;
}

.age-cell {
    text-align: center;
    font-family: 'Courier New', monospace;
}

.age-value.age-high {
    color: var(--cor-alerta);
    font-weight: 600;
}

.age-value.age-medium {
    color: var(--cor-alto);
    font-weight: 500;
}

/* Badges */
.severity-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    border-left: 3px solid;
    background: #f8f9fa;
    white-space: nowrap;
}

.severity-badge.severe {
    background: #ffebee;
    color: var(--cor-severo);
    border-left-color: var(--cor-severo);
}

.severity-badge.high {
    background: #fff3e0;
    color: var(--cor-alto);
    border-left-color: var(--cor-alto);
}

.severity-badge.medium {
    background: #fffbf0;
    color: #f57c00;
    border-left-color: var(--cor-medio);
}

.severity-badge.low {
    background: #f5f5f5;
    color: var(--cor-baixo);
    border-left-color: var(--cor-baixo);
}

.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-open {
    background: #e3f2fd;
    color: var(--cor-info);
}

.status-badge.status-progress {
    background: #fff3e0;
    color: var(--cor-alto);
}

.status-badge.status-pending {
    background: #fffbf0;
    color: #f57c00;
}

.status-badge.status-closed {
    background: #e8f5e8;
    color: var(--cor-sucesso);
}

.status-badge.status-other {
    background: #f5f5f5;
    color: #6c757d;
}

/* Ações */
.actions-cell {
    text-align: center;
}

.update-cell {
    text-align: center;
    font-size: 12px;
}

.update-date {
    color: var(--cor-texto-secundario);
}

.row-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.action-btn {
    background: none;
    border: 1px solid var(--cor-border);
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #f8f9fa;
    border-color: var(--cor-info);
}

.view-btn:hover {
    background: #e3f2fd;
}

.edit-btn:hover {
    background: #fff3e0;
}

/* Paginação */
.table-footer {
    padding: 12px 20px;
    background: #f8f9fa;
    border-top: 1px solid var(--cor-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    font-size: 13px;
    color: #6c757d;
}

.pagination-controls {
    display: flex;
    gap: 4px;
    align-items: center;
}

.pagination-btn {
    padding: 6px 12px;
    border: 1px solid var(--cor-border);
    background: white;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: var(--cor-info);
}

.pagination-btn.active {
    background: var(--cor-info);
    color: white;
    border-color: var(--cor-info);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 6px 4px;
    color: #6c757d;
}

/* Sem dados */
.no-data {
    text-align: center;
    padding: 40px 20px;
}

.no-data-message {
    color: #6c757d;
    font-size: 14px;
}

/* Responsividade */
@media (max-width: 768px) {
    .table-header-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input {
        width: 100%;
    }
    
    .ros-table {
        font-size: 12px;
    }
    
    .ros-table thead th,
    .ros-table tbody td {
        padding: 8px 6px;
    }
    
    .desc-cell {
        max-width: 200px;
    }
    
    .responsible-cell {
        max-width: 100px;
    }
    
    .table-footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .pagination-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .pagination-btn {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .table-responsive {
        max-height: 400px;
    }
    
    .ros-table thead th:nth-child(n+6),
    .ros-table tbody td:nth-child(n+6) {
        display: none; /* Ocultar colunas menos importantes */
    }
    
    .gmr-tag,
    .ger-info {
        display: none;
    }
    
    .severity-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
}