/* ================================================================
   SHARED COMPONENTS - CHECKLIST VIRTUAL
   Sistema de design unificado para consistência visual
   ================================================================ */

/* ----------------------------------------------------------------
   CSS VARIABLES ESTENDIDAS
   ---------------------------------------------------------------- */
:root {
    --cor-primaria: #e30615;
    --cor-texto-escuro: #2d3748;
    --cor-texto-claro: #4a5568;
    --cor-fundo: #f7fafc;
    --cor-container: #ffffff;
    --cor-sombra: rgba(0, 0, 0, 0.07);
    --cor-borda-suave: #e2e8f0;
    --cor-sucesso: #28a745;
    --cor-info: #4299e1;

    /* Botões */
    --btn-blue: #1e40af;
    --btn-blue-hover: #1e3a8a;
    --btn-yellow: #ffc107;
    --btn-yellow-hover: #e0a800;
    --btn-red: #dc3545;
    --btn-red-hover: #c82333;
    --btn-purple: #9c27b0;
    --btn-purple-hover: #7b1fa2;
    --btn-orange: #ff9800;
    --btn-orange-hover: #f57c00;
    --btn-gray: #6c757d;
    --btn-gray-hover: #5a6268;

    /* Animação */
    --transition-fast: all 0.15s ease-out;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ----------------------------------------------------------------
   STATUS BADGES UNIFICADOS
   ---------------------------------------------------------------- */
.status-tag {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    white-space: nowrap;
    border: 2px solid transparent;
    letter-spacing: 0.3px;
    transition: var(--transition-fast);
}

.status-aprovado {
    background-color: #28a745;
    border-color: #1e7e34;
    color: #ffffff;
}

.status-reprovado {
    background-color: #dc3545;
    border-color: #bd2130;
    color: #ffffff;
}

.status-pendente {
    background-color: #ffc107;
    border-color: #d39e00;
    color: #1a1a1a;
}

.status-pendente-avaliação-técnico,
.status-pendente-avaliacao-tecnico {
    background-color: #17a2b8;
    border-color: #117a8b;
    color: #ffffff;
}

.status-pendente-claro {
    background-color: #0dcaf0;
    border-color: #0aa2c0;
    color: #1a1a1a;
}

.status-pendente-delfia {
    background-color: #fd7e14;
    border-color: #dc6502;
    color: #1a1a1a;
}

.status-pendente-assinatura {
    background-color: #9c27b0;
    border-color: #7b1fa2;
    color: #ffffff;
}

.status-rascunho {
    background-color: #6c757d;
    border-color: #495057;
    color: #ffffff;
}

.status-rascunho-assinatura {
    background-color: #fd7e14;
    border-color: #e8590c;
    color: #ffffff;
}

.status-em-andamento {
    background-color: #ff9800;
    border-color: #f57c00;
    color: #1a1a1a;
}

.status-finalizado {
    background-color: #4caf50;
    border-color: #388e3c;
    color: #ffffff;
}

/* ----------------------------------------------------------------
   BOTÕES DE AÇÃO (TABELAS)
   ---------------------------------------------------------------- */
.button-view,
.button-edit,
.button-delete,
.button-sign,
.button-evaluate {
    padding: 6px 12px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 11px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    line-height: 1.4;
}

.button-view {
    background-color: var(--btn-blue);
    color: #ffffff;
    border: 2px solid #1e3a8a;
}
.button-view:hover {
    background-color: var(--btn-blue-hover);
    border-color: #172554;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.5);
}

.button-edit {
    background-color: var(--btn-yellow);
    color: #212529;
    border: 2px solid #d39e00;
}
.button-edit:hover {
    background-color: var(--btn-yellow-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.button-delete {
    background-color: var(--btn-red);
    color: white;
    border: 2px solid #bd2130;
}
.button-delete:hover {
    background-color: var(--btn-red-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.button-sign {
    background-color: var(--btn-purple);
    color: white;
    border: 2px solid #7b1fa2;
}
.button-sign:hover {
    background-color: var(--btn-purple-hover);
    border-color: #6a1b9a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4);
}

.button-evaluate {
    background-color: var(--btn-orange);
    color: white;
    border: 2px solid #f57c00;
}
.button-evaluate:hover {
    background-color: var(--btn-orange-hover);
    border-color: #e65100;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

/* ----------------------------------------------------------------
   LOADING SPINNER
   ---------------------------------------------------------------- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

.spinner-primary {
    border-color: rgba(227, 6, 21, 0.2);
    border-top-color: var(--cor-primaria);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Loading overlay para containers */
.loading-overlay {
    position: relative;
    pointer-events: none;
    opacity: 0.5;
}

.loading-overlay::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border: 4px solid rgba(227, 6, 21, 0.2);
    border-top-color: var(--cor-primaria);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    z-index: 10;
}

/* Botão com loading */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

/* ----------------------------------------------------------------
   SKELETON LOADING
   ---------------------------------------------------------------- */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 20%, #f0f0f0 40%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 6px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    width: 80%;
}

.skeleton-title {
    height: 32px;
    width: 50%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 100px;
    margin-bottom: 15px;
}

.skeleton-badge {
    height: 24px;
    width: 90px;
    border-radius: 20px;
}

/* ----------------------------------------------------------------
   EMPTY STATE (ESTADO VAZIO)
   ---------------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--cor-texto-claro);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.4;
    filter: grayscale(30%);
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--cor-texto-escuro);
    margin-bottom: 12px;
}

.empty-state-message {
    font-size: 15px;
    margin-bottom: 24px;
    line-height: 1.6;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state-action .btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: var(--cor-primaria);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.empty-state-action .btn-action:hover {
    background-color: #c4050f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(227, 6, 21, 0.3);
}

/* ----------------------------------------------------------------
   FILTROS UNIFICADOS
   ---------------------------------------------------------------- */
.filtros-container {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid var(--cor-borda-suave);
    flex-wrap: wrap;
    align-items: flex-end;
}

.filtro-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
    flex: 1;
}

.filtro-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--cor-texto-escuro);
}

.filtro-group select,
.filtro-group input {
    padding: 10px 12px;
    border: 1px solid var(--cor-borda-suave);
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    background: white;
    color: var(--cor-texto-escuro);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.filtro-group select:focus,
.filtro-group input:focus {
    outline: none;
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 3px rgba(227, 6, 21, 0.15);
}

.filtros-acoes {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.btn-filtro {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background-color: var(--cor-primaria);
    color: white;
}

.btn-filtro:hover {
    background-color: #c4050f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(227, 6, 21, 0.3);
}

.btn-limpar {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background-color: var(--btn-gray);
    color: white;
}

.btn-limpar:hover {
    background-color: var(--btn-gray-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* ----------------------------------------------------------------
   CSS TOOLTIPS
   ---------------------------------------------------------------- */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
    max-width: 250px;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.85);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
}

/* ----------------------------------------------------------------
   BREADCRUMBS
   ---------------------------------------------------------------- */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--cor-texto-claro);
    flex-wrap: wrap;
}

.breadcrumbs a {
    color: var(--cor-primaria);
    text-decoration: none;
    transition: var(--transition-fast);
    font-weight: 500;
}

.breadcrumbs a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.breadcrumbs-separator {
    color: var(--cor-texto-claro);
    opacity: 0.5;
    font-size: 16px;
}

.breadcrumbs-current {
    color: var(--cor-texto-escuro);
    font-weight: 600;
}

/* ----------------------------------------------------------------
   BARRA DE PROGRESSO (FORMULÁRIOS)
   ---------------------------------------------------------------- */
.form-progress {
    position: sticky;
    top: 0;
    background: var(--cor-container);
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    margin: -20px -30px 30px -30px;
    border-radius: 8px 8px 0 0;
}

.form-progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.form-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cor-primaria) 0%, #ff4444 100%);
    transition: width 0.4s ease;
    border-radius: 4px;
    min-width: 0;
}

.form-progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--cor-texto-claro);
}

.form-progress-label {
    font-weight: 500;
}

.form-progress-percentage {
    font-weight: 700;
    color: var(--cor-primaria);
    font-size: 14px;
}

/* ----------------------------------------------------------------
   SIDEBAR - INDICADOR DE PÁGINA ATIVA
   ---------------------------------------------------------------- */
.nav-item a.active {
    position: relative;
    background-color: var(--cor-primaria) !important;
    color: white !important;
}

.nav-item a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: white;
    border-radius: 0 3px 3px 0;
}

/* ----------------------------------------------------------------
   PAGINAÇÃO UNIFICADA
   ---------------------------------------------------------------- */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 15px;
    margin-top: 25px;
    background: var(--cor-container);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--cor-sombra);
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    font-size: 14px;
    color: var(--cor-texto-claro);
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid var(--cor-borda-suave);
    border-radius: 6px;
    background: var(--cor-container);
    color: var(--cor-texto-escuro);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--cor-primaria);
    color: white;
    border-color: var(--cor-primaria);
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f1f1f1;
}

.pagination-number {
    padding: 8px 12px;
    min-width: 40px;
    text-align: center;
    border: 1px solid var(--cor-borda-suave);
    border-radius: 6px;
    background: var(--cor-container);
    color: var(--cor-texto-escuro);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.pagination-number:hover {
    background-color: rgba(227, 6, 21, 0.1);
    border-color: var(--cor-primaria);
}

.pagination-number.active {
    background-color: var(--cor-primaria);
    color: white;
    border-color: var(--cor-primaria);
    font-weight: 600;
}

/* ----------------------------------------------------------------
   TABELA MOBILE - CARD LAYOUT
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    .table-mobile-cards thead {
        display: none;
    }

    .table-mobile-cards tbody tr {
        display: block;
        margin-bottom: 15px;
        border-radius: 10px;
        box-shadow: 0 4px 12px var(--cor-sombra);
        border: 1px solid var(--cor-borda-suave);
        background: var(--cor-container);
        overflow: hidden;
    }

    .table-mobile-cards tbody td {
        display: grid !important;
        grid-template-columns: 120px 1fr;
        gap: 10px;
        align-items: center;
        font-size: 14px;
        border-bottom: 1px solid var(--cor-borda-suave);
        padding: 12px 15px !important;
        width: 100% !important;
        box-sizing: border-box;
        text-align: left !important;
    }

    .table-mobile-cards tbody td:last-child {
        border-bottom: 0;
    }

    .table-mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--cor-texto-escuro);
        font-size: 12px;
        text-transform: uppercase;
    }

    .table-mobile-cards tbody td[data-label="Ação"],
    .table-mobile-cards tbody td[data-label="Ações"] {
        display: flex !important;
        flex-direction: column;
        gap: 8px;
    }

    .table-mobile-cards tbody td[data-label="Ação"]::before,
    .table-mobile-cards tbody td[data-label="Ações"]::before {
        display: none;
    }

    .table-mobile-cards tbody td[data-label="Ação"] a,
    .table-mobile-cards tbody td[data-label="Ação"] button,
    .table-mobile-cards tbody td[data-label="Ações"] a,
    .table-mobile-cards tbody td[data-label="Ações"] button {
        width: 100%;
        text-align: center;
        justify-content: center;
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Filtros empilhados */
    .filtros-container {
        padding: 15px;
    }

    .filtro-group {
        min-width: 100%;
    }

    /* Paginação compacta */
    .pagination-container {
        justify-content: center;
    }

    .pagination-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .pagination-number {
        padding: 6px 10px;
        min-width: 35px;
        font-size: 12px;
    }

    .hide-mobile {
        display: none !important;
    }

    /* Progress bar ajuste mobile */
    .form-progress {
        margin: -10px -15px 20px -15px;
        padding: 12px 15px;
    }

    /* Breadcrumbs */
    .breadcrumbs {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .table-mobile-cards tbody td {
        grid-template-columns: 100px 1fr;
        padding: 10px 12px !important;
        font-size: 13px;
    }

    .empty-state {
        padding: 40px 15px;
    }

    .empty-state-icon {
        font-size: 48px;
    }

    .empty-state-title {
        font-size: 18px;
    }
}

/* ----------------------------------------------------------------
   ACESSIBILIDADE - REDUCED MOTION
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .skeleton {
        animation: none;
        background: #f0f0f0;
    }

    .form-progress-fill {
        transition: none;
    }
}

/* ----------------------------------------------------------------
   CAMPO COM ERRO (VALIDAÇÃO)
   ---------------------------------------------------------------- */
.field-error {
    border: 2px solid #dc3545 !important;
    animation: shake 0.3s;
}

.field-error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ----------------------------------------------------------------
   UTILITÁRIOS
   ---------------------------------------------------------------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

/* ----------------------------------------------------------------
   COOKIE CONSENT BANNER
   ---------------------------------------------------------------- */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: #ffffff;
    border-top: 3px solid var(--cor-primaria, #e30613);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    padding: 0;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cookie-banner-show {
    transform: translateY(0);
}

.cookie-banner-hide {
    transform: translateY(100%);
}

.cookie-banner-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 30px;
}

.cookie-banner-icon {
    font-size: 36px;
    flex-shrink: 0;
}

.cookie-banner-text {
    flex: 1;
}

.cookie-banner-title {
    font-weight: 700;
    font-size: 16px;
    color: #2d3748;
    margin: 0 0 4px 0;
}

.cookie-banner-desc {
    font-size: 13px;
    color: #4a5568;
    margin: 0;
    line-height: 1.5;
}

.cookie-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.cookie-btn-accept {
    background-color: var(--cor-primaria, #e30613);
    color: #fff;
}

.cookie-btn-accept:hover {
    background-color: #c00410;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(227, 6, 19, 0.3);
}

.cookie-btn-decline {
    background-color: #f7fafc;
    color: #4a5568;
    border: 1px solid #cbd5e0;
}

.cookie-btn-decline:hover {
    background-color: #edf2f7;
    border-color: #a0aec0;
}

.cookie-declined-notice {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    z-index: 10000;
    background: #2d3748;
    color: #fff;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.cookie-declined-notice p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    flex: 1;
}

.cookie-notice-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.cookie-btn-close {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

.cookie-btn-close:hover {
    color: #fff;
}

@media (max-width: 768px) {
    .cookie-banner-content {
        flex-direction: column;
        text-align: center;
        padding: 20px;
        gap: 14px;
    }

    .cookie-banner-icon {
        font-size: 30px;
    }

    .cookie-banner-actions {
        width: 100%;
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
        padding: 12px;
    }
}
