/* ============================================
   PÁGINA DE PROCESSOS
   ============================================ */

/* Filtros */
.filter-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.filter-card .form-control,
.filter-card .form-select {
    border: 1px solid #e0e0e0;
    border-radius: 0.375rem;
    height: 2.5rem;
}

.filter-card .form-control:focus,
.filter-card .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
}

.filter-actions .btn {
    flex: 1;
}

/* Tabela de Processos */
.processo-table {
    margin-top: 1rem;
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
}

/* Garantir que table-responsive não quebra alinhamento */
.table-responsive .processo-table {
    width: 100%;
}

.processo-table th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.6px;
    border-top: 2px solid #dee2e6;
    border-bottom: 2px solid #dee2e6;
    padding: 12px 8px !important;
    height: 50px;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.processo-table th[onclick] {
    user-select: none;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.processo-table th[onclick]:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.processo-table th[onclick] i {
    transition: color 0.2s ease;
    color: #667eea;
}

.processo-table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    height: 50px;
}

.processo-table tbody tr td {
    padding: 12px 10px !important;
    vertical-align: middle;
    font-size: 0.9rem;
    line-height: 1.2;
}

.processo-table tbody tr:hover {
    background-color: #f9f9f9;
    box-shadow: inset 0 0 0 1px #e9ecef;
}

/* Alinhamento específico das colunas */
.processo-table tbody tr td:nth-child(1) {
    text-align: center;
    width: 90px;
    font-weight: 600;
    padding: 10px 8px !important;
}

.processo-table tbody tr td:nth-child(2) {
    text-align: center;
    width: 120px;
    font-weight: 600;
    color: #d97706;
    padding: 10px 8px !important;
}

.processo-table tbody tr td:nth-child(3) {
    text-align: center;
    width: 180px;
    min-width: 150px;
    padding: 10px 8px !important;
}

.processo-table tbody tr td:nth-child(4) {
    text-align: center;
    width: 160px;
    min-width: 140px;
    padding: 10px 8px !important;
}

.processo-table tbody tr td:nth-child(5) {
    text-align: center;
    width: 80px;
    padding: 10px 8px !important;
}

.processo-table tbody tr td:nth-child(6) {
    text-align: center;
    width: 80px;
    padding: 10px 8px !important;
}

.processo-table tbody tr td:nth-child(7) {
    text-align: center;
    width: 90px;
    padding: 10px 8px !important;
}

.processo-table tbody tr td:nth-child(8) {
    text-align: center;
    width: 140px;
    font-size: 0.85rem;
    padding: 10px 8px !important;
}

.processo-table tbody tr td:nth-child(9) {
    text-align: center;
    width: 200px;
    padding: 10px 8px !important;
}

.processo-numero {
    font-weight: 600;
    color: #2c3e50;
    background-color: #ecf0f1;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    display: inline-block;
    text-transform: uppercase;
    text-align: center;
}

.processo-empresa {
    color: #555;
    font-weight: 500;
    background-color: #f5f5f5;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    display: inline-block;
    text-transform: uppercase;
    text-align: center;
}

.processo-aditivo {
    display: inline-block;
    text-align: center;
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

.processo-secretaria {
    display: inline-block;
    text-align: center;
}

.processo-vigencia {
    background-color: #fce4ec;
    color: #c2185b;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    display: inline-block;
    text-align: center;
}

.processo-valor {
    background-color: #fff3e0;
    color: #e65100;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
    display: inline-block;
}

.processo-secretaria {
    background-color: #e3f2fd;
    color: #1565c0;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    display: inline-block;
}

.processo-modalidade {
    background-color: #f3e5f5;
    color: #6a1b9a;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    display: inline-block;
}

/* Status Badges - Cores Padronizadas */
.status-badge {
    padding: 0.35rem 0.6rem;
    border-radius: 0.375rem;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: none;
}

.status-ativo {
    background-color: #10b981;
    color: #ffffff;
}

.status-ativo:hover {
    background-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.status-vencido {
    background-color: #ef4444;
    color: #ffffff;
}

.status-vencido:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.status-vencendo {
    background-color: #f59e0b;
    color: #ffffff;
}

.status-vencendo:hover {
    background-color: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.status-suspenso {
    background-color: #06b6d4;
    color: #ffffff;
}

.status-suspenso:hover {
    background-color: #0891b2;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(6, 182, 212, 0.2);
}

/* Dias Restantes - Coluna com cronômetro */
.dias-restantes-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(135deg, #fef08a 0%, #fde047 100%);
    color: #7c2d12;
    padding: 0.3rem 0.6rem;
    border-radius: 0.375rem;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(232, 179, 8, 0.2);
    transition: all 0.3s ease;
    cursor: help;
    white-space: nowrap;
}

.dias-restantes-badge:hover {
    background: linear-gradient(135deg, #fde047 0%, #facc15 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(232, 179, 8, 0.2);
}

.dias-restantes-badge i {
    font-size: 0.85rem;
    animation: pulse-hourglass 2s infinite;
}

.dias-numero {
    font-weight: 800;
    font-size: 0.85rem;
}

@keyframes pulse-hourglass {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Ações - Botões Padronizados */
.acao-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.acao-buttons .btn {
    padding: 0.35rem 0.55rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    height: 32px;
    min-width: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.acao-buttons .btn i {
    font-size: 0.8rem;
}

.acao-buttons .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.acao-buttons .btn-success {
    background-color: #10b981;
    color: white;
}

.acao-buttons .btn-success:hover {
    background-color: #059669;
}

.acao-buttons .btn-primary {
    background-color: #3b82f6;
    color: white;
}

.acao-buttons .btn-primary:hover {
    background-color: #2563eb;
}

.acao-buttons .btn-info {
    background-color: #06b6d4;
    color: white;
}

.acao-buttons .btn-info:hover {
    background-color: #0891b2;
}

.acao-buttons .btn-danger {
    background-color: #ef4444;
    color: white;
}

.acao-buttons .btn-danger:hover {
    background-color: #c0392b;
    transform: translateY(-1px);
}

.btn-view {
    background-color: #3498db;
    color: white;
    padding: 0.35rem 0.65rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    border: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-delete:hover {
    background-color: #c0392b;
    color: white;
    text-decoration: none;
}

.btn-view {
    background-color: #27ae60;
    color: white;
    padding: 0.35rem 0.65rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    border: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-view:hover {
    background-color: #229954;
    color: white;
    text-decoration: none;
}

/* Modal */
.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-title {
    font-weight: 600;
}

.form-section-title {
    font-weight: 600;
    color: #2c3e50;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e9ecef;
    font-size: 1rem;
}

.form-section-title:first-child {
    margin-top: 0;
}

/* Paginação */
.pagination {
    margin-top: 2rem;
    gap: 0.25rem;
}

.page-link {
    color: #667eea;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.page-link:hover {
    color: white;
    background-color: #667eea;
    border-color: #667eea;
}

.page-item.active .page-link {
    background-color: #667eea;
    border-color: #667eea;
}

/* Estados */
.no-data {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.no-data i {
    font-size: 2.5rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.loading-state {
    text-align: center;
    padding: 2rem;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Vigência */
.vigencia-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vigencia-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.vigencia-ok {
    background-color: #d4edda;
    color: #155724;
}

.vigencia-warning {
    background-color: #fff3cd;
    color: #856404;
}

.vigencia-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Responsive */
@media (max-width: 768px) {
    .filter-card {
        padding: 1rem;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .filter-actions .btn {
        flex: none;
        width: 100%;
    }
    
    .processo-table {
        font-size: 0.8rem;
    }
    
    .processo-table th,
    .processo-table td {
        padding: 0.5rem 0.25rem;
    }
    
    .acao-buttons {
        flex-direction: column;
    }
    
    .btn-edit,
    .btn-delete,
    .btn-view {
        width: 100%;
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    .processo-secretaria,
    .processo-modalidade {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
    
    .status-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Print */
@media print {
    .filter-card,
    .pagination,
    .btn-edit,
    .btn-delete,
    .btn-view,
    .acao-buttons {
        display: none;
    }
    
    .processo-table {
        page-break-inside: avoid;
    }
    
    .processo-table tr {
        page-break-inside: avoid;
    }
}

/* Modal Aditivo */
#aditivoModal .modal-header {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

#aditivoModal .form-section-title {
    color: #17a2b8;
    border-bottom-color: #17a2b8;
}

#aditivoModal .form-check {
    margin-bottom: 0.75rem;
}

#aditivoModal .form-check-input {
    border-color: #dee2e6;
    cursor: pointer;
}

#aditivoModal .form-check-input:checked {
    background-color: #17a2b8;
    border-color: #17a2b8;
}

#aditivoModal .alert {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

#aditivoModal .alert-info {
    font-size: 0.9rem;
}

#novoTerminoContainer {
    animation: slideDown 0.3s ease;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   FLUXOGRAMA DE DETALHES DO CONTRATO
   ============================================ */

.detalhe-fluxograma-container {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #f0f0f0;
}

/* Accordion styling */
.accordion .accordion-button {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    border: 1px solid #e9ecef;
    padding: 0.75rem 1.25rem;
}

.accordion .accordion-button:not(.collapsed) {
    background-color: #e7f3ff;
    color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.accordion .accordion-button:focus {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.accordion .accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23667eea'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

.accordion-body {
    padding: 1.5rem;
    background-color: #ffffff;
    border-top: 1px solid #e9ecef;
}

.detalhe-fluxograma {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detalhe-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f2f5 100%);
    border: 2px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    animation: slideDown 0.3s ease-out;
}

.detalhe-box:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #0d6efd;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.detalhe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
}

.detalhe-info {
    flex: 1;
}

.detalhe-info strong {
    display: block;
    color: #495057;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.detalhe-info .text-muted {
    font-size: 0.85rem;
    color: #868e96 !important;
}

.detalhe-delete-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.detalhe-delete-btn:hover {
    transform: scale(1.1);
}

.detalhe-body {
    color: #2c3e50;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: 0.95rem;
}

.detalhe-arrow {
    display: flex;
    justify-content: center;
    color: #adb5bd;
    font-size: 1.25rem;
    margin: 0.5rem 0;
}

.detalhe-arrow i {
    animation: bounce 1.5s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(8px);
    }
}

/* Responsivo */
@media (max-width: 768px) {
    .detalhe-box {
        padding: 1rem;
    }
    
    .detalhe-header {
        flex-direction: column;
    }
    
    .detalhe-delete-btn {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }
}
