/* ============================================================
   Sebrae/MS – Sistema de Devoluções (Reembolso)
   Estilos customizados
   ============================================================ */

/* ---------- Layout geral ---------- */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: 270px;
    min-height: 100vh;
    background: linear-gradient(180deg, #0065B2 0%, #004d8c 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: margin-left 0.3s ease;
    z-index: 1040;
}

.sidebar-header {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-logo {
    max-width: 130px;
    max-height: 70px;
    height: auto;
    display: inline-block;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.75);
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-left-color: #ffc107;
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border-left-color: #ffc107;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Em telas pequenas, esconde a sidebar */
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: -270px;
        position: fixed;
    }
    .sidebar.show {
        margin-left: 0;
    }
}

/* ---------- Main content ---------- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f8f9fa;
}

.topbar {
    background: #fff;
    min-height: 58px;
}

/* ---------- Cards ---------- */
.card {
    border: none;
}

.card-header {
    font-weight: 600;
}

.designacao-etapa-card {
    min-height: 72px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.designacao-etapa-card .card-body {
    padding: 0.5rem 0.75rem;
}

.designacao-etapa-link:hover .designacao-etapa-card {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12) !important;
}

.designacao-etapa-link[aria-current="page"] .designacao-etapa-card {
    outline: 2px solid #212529;
    outline-offset: 2px;
}

/* ---------- Badge de status ---------- */
.badge {
    font-weight: 500;
    letter-spacing: 0.03em;
}

/* ---------- Tabelas ---------- */
.table > :not(caption) > * > * {
    padding: 0.6rem 0.75rem;
}

/* ---------- Formulários com campos dinâmicos ---------- */
#titularPf,
#titularPj {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}

#titularPf > [class*="col-"],
#titularPj > [class*="col-"] {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* ---------- Inputs de token ---------- */
.token-input {
    font-size: 1.5rem;
    letter-spacing: 0.5rem;
    text-align: center;
    font-weight: 700;
}

/* ---------- Alertas ---------- */
.alert {
    border: none;
    border-radius: 0.5rem;
}

/* ---------- Footer ---------- */
footer {
    margin-top: auto;
}

/* ---------- Página de login / Portal Duplo ---------- */
.auth-page {
    background: radial-gradient(circle at 50% 10%, #0d2744 0%, #061322 70%, #020912 100%);
    min-height: 100vh;
    color: #e2e8f0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    position: relative;
    overflow-x: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 450px;
    background: radial-gradient(circle, rgba(0, 101, 178, 0.35) 0%, rgba(0, 168, 255, 0.05) 50%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.auth-container {
    position: relative;
    z-index: 1;
}

/* Brand Logo Container */
.auth-logo-badge {
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 16px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    display: inline-block;
    transition: transform 0.3s ease;
}

.auth-logo-badge:hover {
    transform: translateY(-2px);
}

.auth-logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

/* Cards do Portal */
.portal-card {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1.25rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    height: 100%;
}

.portal-card:hover {
    border-color: rgba(0, 168, 255, 0.3);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.portal-card-public {
    border-top: 4px solid #00a8ff;
}

.portal-card-admin {
    border-top: 4px solid #ffb703;
}

/* Cartões de Ação do Cliente */
.public-action-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: all 0.25s ease;
    text-decoration: none !important;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.public-action-card:hover {
    background: rgba(0, 101, 178, 0.2);
    border-color: rgba(0, 168, 255, 0.4);
    transform: translateY(-3px);
    color: #fff;
}

.public-action-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.icon-blue {
    background: rgba(0, 101, 178, 0.25);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.icon-amber {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

/* Inputs do Formulário Admin */
.auth-input-group .input-group-text {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
    color: #94a3b8;
}

.auth-input-group .form-control {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.auth-input-group .form-control:focus {
    background: rgba(15, 23, 42, 0.9);
    border-color: #38bdf8;
    box-shadow: 0 0 0 0.25rem rgba(56, 189, 248, 0.25);
    color: #fff;
}

.auth-input-group .form-control::placeholder {
    color: #64748b;
}

.btn-toggle-password {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
    color: #94a3b8;
}

.btn-toggle-password:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Botão Entrar */
.btn-auth-submit {
    background: linear-gradient(135deg, #0065B2 0%, #004077 100%);
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 0.8rem 1.5rem;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 101, 178, 0.4);
}

.btn-auth-submit:hover {
    background: linear-gradient(135deg, #0077d4 0%, #005096 100%);
    box-shadow: 0 6px 20px rgba(0, 101, 178, 0.6);
    transform: translateY(-1px);
    color: #fff;
}

/* Credenciais de Teste Rápido */
.test-user-badge {
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    font-size: 0.8rem;
    padding: 0.4rem 0.7rem;
    border-radius: 0.5rem;
}

.test-user-badge:hover {
    background: rgba(0, 168, 255, 0.2);
    border-color: #38bdf8;
    color: #fff;
}

/* ============================================================
   Consulta ao Sistema de Caixa (SQL Server) – /admin/caixa
   ============================================================ */

/* ---------- Cartões de resumo ---------- */
.caixa-resumo-card .card-body {
    padding: 1rem 1.1rem;
}

.caixa-resumo-icone {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* ---------- Dados do cliente ---------- */
.caixa-card-cliente {
    border-left: 5px solid #0065B2;
}

.caixa-cliente-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0065B2 0%, #004077 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 101, 178, 0.35);
}

.caixa-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    background: #eef4fb;
    border: 1px solid #d3e3f5;
    color: #00558f;
    border-radius: 999px;
    padding: 0.15rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.5;
}

.caixa-documento {
    text-align: right;
    background: #f8f9fa;
    border: 1px dashed #ced4da;
    border-radius: 0.5rem;
    padding: 0.5rem 0.9rem;
}

.caixa-dado {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    border-left: 3px solid #e9ecef;
    padding-left: 0.85rem;
}

.caixa-dado-rotulo {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    font-weight: 600;
}

.caixa-dado-valor {
    font-weight: 600;
    color: #212529;
    word-break: break-word;
}

/* ---------- Tabela de produtos ---------- */
.tabela-caixa {
    border-collapse: separate;
    border-spacing: 0;
}

.tabela-caixa thead th {
    background: linear-gradient(180deg, #0065B2 0%, #00508e 100%);
    color: #fff;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    border-bottom: none;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

.tabela-caixa tbody tr:nth-child(even) {
    background: #f7fafd;
}

.tabela-caixa tbody tr:hover {
    background: #e8f2fb;
}

.tabela-caixa tbody td {
    border-color: #e9eef4;
    font-size: 0.9rem;
    vertical-align: middle;
}

.tabela-caixa tfoot td {
    background: #eef4fb;
    border-top: 2px solid #cfe0f2;
    font-size: 0.9rem;
}

.tabela-caixa .caixa-codcusto {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.82rem;
    background: #f1f3f5;
    border: 1px solid #e2e6ea;
    border-radius: 0.35rem;
    padding: 0.1rem 0.4rem;
    white-space: nowrap;
}

.tabela-caixa .caixa-descricao {
    min-width: 320px;
    max-width: 620px;
    color: #343a40;
    line-height: 1.35;
}

.tabela-caixa .caixa-valor {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
    color: #0b5d1e;
}

/* ---------- Badges de status do Sistema de Caixa ---------- */
.caixa-status {
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    text-transform: capitalize;
}

.caixa-status.status-success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #a3cfbb;
}

.caixa-status.status-warning {
    background: #fff3cd;
    color: #664d03;
    border: 1px solid #ffe69c;
}

.caixa-status.status-info {
    background: #cff4fc;
    color: #055160;
    border: 1px solid #9eeaf9;
}

.caixa-status.status-primary {
    background: #cfe2ff;
    color: #084298;
    border: 1px solid #9ec5fe;
}

.caixa-status.status-dark {
    background: #d3d3d4;
    color: #1a1d20;
    border: 1px solid #bcbebf;
}

.caixa-status.status-secondary {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #dee2e6;
}

/* ---------- Combobox de documentos de teste (fase de testes) ---------- */
.documentos-teste-menu {
    max-height: 320px;
    overflow-y: auto;
    min-width: 280px;
}

.documentos-teste-menu .dropdown-item {
    font-variant-numeric: tabular-nums;
}

/* ---------- Utilidades ---------- */
/* Formulário externo centralizado; preserva espaço em telas menores. */
@media (min-width: 992px) {
    .solicitacao-externa-container {
        width: 70%;
    }
}

.cursor-pointer {
    cursor: pointer;
}

/* ---------- Scrollbar customizada (opcional) ---------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===== Lista de compras faturadas (formulário público) ===== */
/* Usa <select size="4"> como caixa de rolagem para permitir que cada item
   ocupe duas linhas (um <select> simples não quebra o texto da option). */
.caixa-produtos-lista {
    height: auto;
    min-height: 7.5rem;
    padding: 0.25rem;
}

.caixa-produtos-lista option {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
    padding: 0.5rem 0.6rem;
    min-height: 2.6rem;      /* ~duas linhas de texto por item */
    border-bottom: 1px solid #e9ecef;
}

.caixa-produtos-lista option:last-child {
    border-bottom: 0;
}

/* Fundo dos formularios de entrada e filtros. */
form:has(input:not([type="hidden"]), select, textarea) {
    background-color: #eaf3fb;
    padding: 1rem;
    border-radius: 0.5rem;
    color: #212529;
}

/* Mantem as margens da grade Bootstrap dentro do formulario. */
form.row:has(input:not([type="hidden"]), select, textarea) {
    margin-left: 0;
    margin-right: 0;
}

/* Contraste dos campos de login sobre o formulario azul claro. */
.auth-page form .form-label.text-light {
    color: #212529 !important;
}

.auth-page form .auth-input-group .input-group-text,
.auth-page form .btn-toggle-password {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
}

.auth-page form .auth-input-group .form-control {
    background: #fff;
    border-color: #adb5bd;
    color: #212529;
}

.auth-page form .auth-input-group .form-control:focus {
    border-color: #0065b2;
    box-shadow: 0 0 0 0.25rem rgba(0, 101, 178, 0.2);
}
