/* ==========================================================
   01 - VARIÁVEIS
========================================================== */

:root {
    /* ======================================================
       Cores Principais
    ====================================================== */

    --cor-branco: #ffffff;
    --cor-preto: #111827;

    --cor-texto: #111827;
    --cor-texto-secundario: #6b7280;

    --cor-azul: #60a5fa;

    /* ======================================================
       Estados
    ====================================================== */

    --cor-sucesso: #22c55e;
    --cor-erro: #ef4444;
    --cor-aviso: #f59e0b;
    --cor-info: #3b82f6;

    /* ======================================================
       Status Protocolos
    ====================================================== */

    --status-emitido-bg: #DCFCE7;
    --status-emitido-texto: #166534;

    --status-analise-bg: #FEF3C7;
    --status-analise-texto: #92400E;

    --status-pendente-bg: #FFEDD5;
    --status-pendente-texto: #C2410C;

    --status-aguardando-bg: #DBEAFE;
    --status-aguardando-texto: #1D4ED8;

    --status-recusado-bg: #FEE2E2;
    --status-recusado-texto: #B91C1C;

    --status-cancelado-bg: #E5E7EB;
    --status-cancelado-texto: #374151;

    /* ======================================================
    Bordas
    ====================================================== */

    --border-divider: rgba(148,163,184,.25);

    /* ======================================================
    Sombras
    ====================================================== */

    --shadow-card-hover: 0 8px 24px rgba(0,0,0,.32);

    --shadow-modal: 0 12px 30px rgba(0,0,0,.35);

}

/* ==========================================================
   02 - TEMA DARK
========================================================== */

[data-theme="dark"] {

    /* ======================================================
       Fundos / Bordas
    ====================================================== */

    --protocolo-bg: #1e293b;

    --protocolo-card: #0f172a81;

    --protocolo-select: #0f172a;

    --protocolo-border: #334155;

    /* ======================================================
       Textos
    ====================================================== */

    --protocolo-text: #e2e8f0;

    --protocolo-text-secondary: #94a3b8;

    /* ======================================================
       Hover
    ====================================================== */

    --protocolo-hover: #2d36476c;

}

/* ==========================================================
   03 - TEMA LIGHT
========================================================== */

[data-theme="light"] {

    /* ======================================================
       Fundos / Bordas
    ====================================================== */
    
    --protocolo-bg: #ffffff;

    --protocolo-card: #ffffff;

    --protocolo-select: #ffffff;

    --protocolo-border: #e5e7eb;

    /* ======================================================
       Textos
    ====================================================== */

    --protocolo-text: #111827;

    --protocolo-text-secondary: #6b7280;

    /* ======================================================
       Hover
    ====================================================== */

    --protocolo-hover: #f3f4f6;

}

/* ==========================================================
   04 - CONTAINER
========================================================== */

.protocolos-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-right: 20px;
}

.protocolos-box {
    padding: 20px;
    border-radius: 16px;
    background: var(--protocolo-card);
    border: 1px solid var(--protocolo-border);
}

/* ==========================================================
   05 - HEADER
========================================================== */

/* Cabeçalho da página */

.protocolos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Título */

.protocolos-title {
    color: var(--protocolo-text);
    font-size: 28px;
    font-weight: 700;
}

/* Botão Novo Protocolo */

#btnNovoProtocolo {
    min-width: 170px;
    height: 44px;
    white-space: nowrap;
}

/* ==========================================================
   06 - FILTROS
========================================================== */

/* Container dos filtros */

.protocolos-filtros {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Linha dos filtros */

.protocolos-filters-row {
    display: flex;
    gap: 12px;
}

/* Input Busca */

.protocolos-filtros input {
    max-width: 300px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--protocolo-border);
    background: var(--protocolo-bg);
    color: var(--protocolo-text);
}

.protocolos-filtros input:hover {
    border-color: var(--cor-azul);
}

.protocolos-filtros input::placeholder {
    color: var(--protocolo-text-secondary);
    opacity: 1;
}

/* Selects */

.protocolos-filtros select {
    max-width: 200px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--protocolo-border);
    background: var(--protocolo-card);
    color: var(--protocolo-text-secondary);

}

.protocolos-filtros select:hover {
    border-color: var(--cor-azul);
}

.protocolos-filtros select option {
    background: var(--protocolo-select);
}

/* ==========================================================
   07 - RESUMO
========================================================== */

/* Container */

.protocolos-resumo {
    width: fit-content;
    margin-top: 15px;
    padding: 14px 18px;
    border-radius: 12px;
    background: var(--protocolo-bg);
    border: 1px solid rgba(255,255,255,.08);
}

/* Cabeçalho */

.protocolos-resumo-topo {
    display: flex;
    gap: 12px;
    margin: 4px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--protocolo-border);
}

/* Cards do Resumo */

.resumo-item {
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--resumo);
    border: 1px solid var(--protocolo-border);
    font-size: 14px;
    color: var(--protocolo-text);
    cursor: default;
}

/* Títulos */

.protocolos-resumo strong {
    display: block;
    margin-top: 4px;
}

.resumo-item strong {
    margin-left: 6px;
    font-size: 14px;
    font-weight: 600;
}

/* Valores */

#totalProtocolos,
#totalPremioLiquido {
    font-weight: 700;
}

/* ==========================================================
   08 - CARDS
========================================================== */

/* Container dos Cards */

.protocolos-cards-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Card */

.protocolo-card {
    background: var(--protocolo-card);
    border: 1px solid var(--protocolo-border);
    border-radius: 14px;
    padding: 12px;
    transition: .2s ease;
   
}

.protocolo-card:hover {
    background: var(--protocolo-hover);
    border-color: var(--cor-azul);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

/* Cabeçalho do Card */

.protocolo-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* Numero do Protocolo */

.protocolo-numero {
    font-size: 14px;
    font-weight: 500;
    color: var(--protocolo-text);
}

.protocolo-numero span {
    font-weight: 700;
    font-size: 14px;
    margin-left: 15px;
    color: var(--protocolo-text-secondary);
}

.protocolo-status-acoes {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Grid do Card */

.protocolo-grid {
    display: grid;
    grid-template-columns:
        1fr     /* Segurado */
        1fr     /* datacriação*/
        1fr     /* Documento */
        92px    /* Seguradora */
        1fr     /* Corretor */
        1fr     /* Vigência */
        1fr;    /* Financeiro */
    gap: 14px;
    align-items: center;
}

/* Colunas */

.protocolo-item {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 70px;
}

.protocolo-item:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -1px;
    transform: translateY(-50%);
    width: 1px;
    height: 70px;
    background: var(--border-divider);
}

/* Conteúdo*/

.protocolo-label {
    display: block;
    min-height: 16px;
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--protocolo-text-secondary);
}

.protocolo-valor {
    font-weight: 600;
    color: var(--protocolo-text);
}

/* Logo Seguradora */

.seguradora-logo {
    width: 80px;
    height: 65px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--cor-branco);
    padding: 1px;
}

/* Rodapé */

.protocolo-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    border-top: 1px solid var(--protocolo-border);
}

/* ==========================================================
   09 - STATUS
========================================================== */

/* Status Base */

.protocolo-status {
    padding: 6px 12px;
    border-radius: 999px; /* arredondada */
    background: #f59e0b20;
    color: #f59e0b;
    font-size: 12px;
    font-weight: 600;
    min-width: 100px;
    text-align: center;
}

/* Emitido */

.status-emitido {
    background: var(--status-emitido-bg);
    color: var(--status-emitido-texto);
}

/* Em Analise */

.status-analise {

    background: var(--status-analise-bg);
    color: var(--status-analise-texto);

}

/* Pendente */

.status-pendente {

    background: var(--status-pendente-bg);
    color: var(--status-pendente-texto);

}

/* Aguardando */

.status-aguardando {

    background: var(--status-aguardando-bg);
    color: var(--status-aguardando-texto);

}

/* Recusado */

.status-recusado {

    background: var(--status-recusado-bg);
    color: var(--status-recusado-texto);

}

/* Cancelado */

.status-cancelado {

    background: var(--status-cancelado-bg);
    color: var(--status-cancelado-texto);

}
/* ==========================================================
   10 - MENU
========================================================== */

/* Container menu */

.protocolo-menu {
    position: relative;
    cursor: pointer;
    user-select: none;
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--protocolo-text);
}

/* Dropdown */

.menu-acoes {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: var(--protocolo-bg);
    backdrop-filter: none;
    border: 1px solid var(--protocolo-border);
    border-radius: 10px;
    overflow: hidden;
    display: none;
    z-index: 100;
}

.menu-acoes.ativo {
    display: block;
}

/* Botões */
.menu-item {
    width: 100%;
    padding: 12px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--protocolo-text);
}

/* Hover */

.menu-item:hover {
    background: var(--protocolo-hover);
}

/* Excluir */

.menu-item.danger {
    color: var(--cor-erro);
}

/* ==========================================================
   11 - PAGINAÇÃO
========================================================== */

/* Container */

.protocolos-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Botões*/

.protocolos-pagination button {
    height: 40px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid var(--protocolo-border);
    background: var(--protocolo-card);
    color: var(--protocolo-text);
    cursor: pointer;
    transition: all .2s ease;
}

.protocolos-pagination button:hover {
    border-color: var(--cor-azul);
}

/* Desabilitado */
.protocolos-pagination button:disabled {
    opacity: .5;
    cursor: not-allowed;
}
/* ==========================================================
   12 - SPINNER
========================================================== */

/* Container */

.loading-protocolos {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
}

/* Spinner */
.spinner-protocolos {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid
        rgba(59,130,246,.15);
    border-top-color:
        #3b82f6;
    animation:
        spinProtocolos .8s linear infinite;
}

/* Animação spinner */

@keyframes spinProtocolos {

    to {
        transform: rotate(360deg);
    }

}

/* ==========================================================
   13 - FINANCEIRO
========================================================== */

/* Container */

/* Bloco financeiro exibido na última coluna do card */
.protocolo-item-financeiro{
    display:flex;
    flex-direction:column;
}

/* Forma de Pagamento */

.protocolo-forma-pagto{
    font-size:14px;
    font-weight:500;
    color:var(--protocolo-text);
    margin-bottom:2px;
    padding-left: 10px;
}

/* Separador */

.financeiro-divider {
    width: 60%;
    height: 1px;
    background: var(--protocolo-border);
    margin: 2px 0;
}

/* Label Premio */

.premio-label{
    margin-top:4px;
}

/* Prêmio Entrada */

.premio-entrada{
    color:var(--cor-sucesso);
    font-weight:700;
    font-size:20px;
}

/* Prêmio Saída */

.premio-saida{
    color:var(--cor-erro);
    font-weight:700;
    font-size:20px;
}

.premio-liquido {
    font-weight: 700;
    color: #22c55e;
    font-size: 20px;
}

/* ==========================================================
   14 - RESPONSIVO
========================================================== */

/* NOTEBOOK */

@media (max-width: 1400px) {

    .protocolos-filtros{
        flex-wrap: wrap;
        gap: 12px;
    }

    .protocolos-filtros input{
        flex: 1;
        min-width: 170px;
    }

    .protocolos-filtros select{
        flex: 1;
        min-width: 170px;
    }

}

/* CONFIRMAÇÃO */

.confirmacao-info{
    margin:24px 0;
    background:#fafbfc;
    border:1px solid #e5e7eb;
    border-radius:12px;
    overflow: hidden;
}

.confirmacao-info div{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:8px 10px;
}

.confirmacao-info div:not(:last-child){
    border-bottom:1px solid #ececec;
}

.confirmacao-info small{
    color:#6b7280;
    font-size:14px;
}

.confirmacao-info strong{
    color:#111827;
    font-size:16px;
    font-weight:600;
}

.confirmacao-aviso{
    margin-top:22px;
    padding:8px 10px;
    border-radius:12px;
    background:#fff8e7;
    border:1px solid #ffd36a;
}

.confirmacao-aviso strong{
    margin-bottom:10px;
    color:#9a6700;
    font-size:16px;
}

.confirmacao-aviso p{
    margin:0;
    color:#5b4b12;
    font-size:14px;
    line-height:1.4;
}

/* EXCLUIR */

.modal-protocolo-excluir .modal-footer .btn-primary{
    background:#dc3545;
    border-color:#dc3545;
}

.modal-protocolo-excluir .modal-footer .btn-primary:hover{
    background:#bb2d3b;
}

/* ===========================================
   MODAL EXCLUIR PROTOCOLO
=========================================== */

.modal-protocolo-excluir{
    width:600px;
    max-width:95vw;
}

.modal-protocolo-excluir .modal-content{
    width:600px;
    max-width:95vw;
}

.modal-protocolo-excluir .modal-body{
    padding:26px 30px;
}

.modal-protocolo-excluir .modal-footer{
    padding:22px 30px 28px;
    justify-content:flex-end;
}

.modal-protocolo-excluir .btn-primary{
    width:220px;
    height:48px;
    border-radius:10px;
    background:#dc2626;
    border:1px solid #dc2626;
    font-size:15px;
    font-weight:600;
}

.modal-protocolo-excluir .btn-primary:hover{
    background:#b91c1c;
    border-color:#b91c1c;
}

.protocolo-card-destacado {
    border: 2px solid #ef4444 !important;
    box-shadow:
        0 0 25px rgba(239,68,68,.25);
    animation:
        protocoloPulse 1s infinite alternate;
}

@keyframes protocoloPulse {

    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.01);
    }

}

/* TABLET */

@media (max-width:1010px){

    .protocolo-grid{
        grid-template-columns:
            repeat(3,minmax(130px,1fr));
        gap:6px;
    }

    .protocolo-item{
        padding-right:0;
    }

    .protocolo-item::after{
        display:none;
    }

    .protocolos-cards-container{
        gap:16px;
    }

    .protocolo-item-data{
        display:none;
    }

    /* FILTROS */

    .protocolos-filtros{
        display:grid;
        grid-template-columns:repeat(2,1fr);
        gap:12px;
        align-items:stretch;
    }

    .protocolos-filtros input, .protocolos-filtros select{
        width:100%;
        max-width:none;
        min-width:0;
        flex:none;
    }

}


@media (max-width: 768px) {
    .protocolos-container {
        margin-right: 0px;
    }

}

@media (max-width: 503px) {
    .protocolos-container {
        margin-right: 0px;
    } 

    .protocolo-grid{
        grid-template-columns:
            repeat(2,minmax(105px,1fr));
        gap:2px;
    }

}

@media (max-width: 457px) {
    .resumo-item {
        padding: 6px 8px;
        font-size: 12px;
    }

    .resumo-item strong {
        font-size: 11px;
        font-weight: 600;
    }

}