/* =====================================================================
   1. IDENTIDADE VISUAL — cores da marca (verde-petróleo + dourado)
   ===================================================================== */
:root {
    --moneta-primary: #0D3B36;
    --moneta-primary-dark: #08211E;
    --moneta-primary-light: #E8F0EF;
    --moneta-accent: #C9974E;
    --moneta-accent-dark: #A97C38;
    --moneta-accent-light: #FBF3E7;
}

/* -----------------------------------------------------------------
   1.1 Bootstrap grava cor literal (não var()) dentro de --bs-btn-*
   em .btn-primary/.btn-outline-primary/.progress — sobrescrevendo
   direto na propriedade final a gente ignora essa particularidade.
   ----------------------------------------------------------------- */
.btn-primary {
    background-color: var(--moneta-primary) !important;
    border-color: var(--moneta-primary) !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--moneta-primary-dark) !important;
    border-color: var(--moneta-primary-dark) !important;
}

.btn-outline-primary {
    color: var(--moneta-primary) !important;
    border-color: var(--moneta-primary) !important;
}

.btn-outline-primary:hover {
    background-color: var(--moneta-primary) !important;
    border-color: var(--moneta-primary) !important;
    color: #fff !important;
}

.progress,
.progress-stacked {
    --bs-progress-bar-bg: var(--moneta-primary);
}

/* -----------------------------------------------------------------
   1.2 Demais cantos do Sneat que usam a cor primária via variável
   do Bootstrap (esses SIM herdam de --bs-primary normalmente).
   ----------------------------------------------------------------- */
:root,
[data-bs-theme="light"] {
    --bs-primary: #0D3B36;
    --bs-primary-rgb: 13, 59, 54;
    --bs-primary-text-emphasis: #082220;
    --bs-primary-bg-subtle: #d6e3e1;
    --bs-primary-border-subtle: #a8c4c0;
    --bs-link-color: #0D3B36;
    --bs-link-color-rgb: 13, 59, 54;
    --bs-link-hover-color: #08211E;
    --bs-link-hover-color-rgb: 8, 33, 30;
    --bs-focus-ring-color: rgba(13, 59, 54, 0.25);
    --bs-form-check-input-checked-bg-color: #0D3B36;
    --bs-form-check-input-checked-border-color: #0D3B36;
    --bs-form-check-input-focus-border-color: #0D3B36;
    --bs-spinner-color: #0D3B36;
}

.text-primary {
    color: var(--moneta-primary) !important;
}

.badge.bg-label-primary {
    background-color: var(--moneta-primary-light) !important;
    color: var(--moneta-primary) !important;
}

a {
    color: var(--moneta-primary);
}

a:hover {
    color: var(--moneta-primary-dark);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--moneta-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 59, 54, 0.15) !important;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: var(--moneta-primary) !important;
    color: #fff !important;
}

/* -----------------------------------------------------------------
   1.3 Menu lateral — item ativo (fundo verde precisa de texto
   branco, senão o texto herdado escuro some no fundo escuro).
   ----------------------------------------------------------------- */
.menu-vertical .menu-link.active,
.menu-vertical .menu-item.active > .menu-link {
    background-color: var(--moneta-primary) !important;
    color: #fff !important;
}

.menu-vertical .menu-link.active i,
.menu-vertical .menu-item.active > .menu-link i {
    color: #fff !important;
}

/* -----------------------------------------------------------------
   1.4 Dourado — cor de destaque secundária (uso pontual)
   ----------------------------------------------------------------- */
.btn-accent {
    background-color: var(--moneta-accent) !important;
    border-color: var(--moneta-accent) !important;
    color: #fff !important;
}

.btn-accent:hover {
    background-color: var(--moneta-accent-dark) !important;
    border-color: var(--moneta-accent-dark) !important;
}

.badge.bg-label-accent {
    background-color: var(--moneta-accent-light) !important;
    color: var(--moneta-accent-dark) !important;
}

.text-accent {
    color: var(--moneta-accent) !important;
}


/* =====================================================================
   2. SELECT NATIVO — seta customizada e visual de "clicável"
   ===================================================================== */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%230D3B36' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 0.75rem 0.75rem;
    border: 0.0625rem solid #d9dee3;
    border-radius: 0.375rem;
    padding-right: 2.5rem;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-select:hover {
    border-color: var(--moneta-primary);
    background-color: #fafbfb;
}

.form-select:disabled {
    cursor: not-allowed;
    background-color: #f5f5f5;
    opacity: 0.7;
}


/* =====================================================================
   3. LOGIN — botões sociais (Google/Facebook)
   ===================================================================== */
.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 1rem;
}

.btn-social-facebook {
    background-color: #1877F2;
    color: #fff;
    border: none;
}

.btn-social-facebook:hover {
    background-color: #145dbf;
    color: #fff;
}

.btn-social-google {
    background-color: #fff;
    color: #3c4043;
    border: 0.0625rem solid #dadce0;
}

.btn-social-google:hover {
    background-color: #f8f9fa;
    color: #3c4043;
}


/* =====================================================================
   4. ALERTAS E BADGES — sucesso
   ===================================================================== */
.alert-success {
    background-color: #e3f6e8 !important;
    border-color: #a8dfb5 !important;
    color: #1a7431 !important;
}

.alert-success .btn-close {
    filter: invert(28%) sepia(55%) saturate(1000%) hue-rotate(90deg) brightness(90%);
}

.badge.bg-label-success {
    background-color: #d4f1db !important;
    color: #1a7431 !important;
}


/* =====================================================================
   5. BOTÕES DE ÍCONE — hover suave (editar/excluir/whatsapp)
   ===================================================================== */
.btn-icon-soft-primary:hover {
    background-color: rgba(105, 108, 255, 0.12) !important;
    border-color: rgba(105, 108, 255, 0.3) !important;
    color: #696cff !important;
}

.btn-icon-soft-danger:hover {
    background-color: rgba(255, 62, 29, 0.12) !important;
    border-color: rgba(255, 62, 29, 0.3) !important;
    color: #ff3e1d !important;
}

.btn-icon-soft-success:hover {
    background-color: rgba(40, 199, 111, 0.12) !important;
    border-color: rgba(40, 199, 111, 0.3) !important;
    color: #28c76f !important;
}


/* =====================================================================
   6. BUSCA DE BANCOS — dropdown de resultado (bank-search.js)
   ===================================================================== */
.bank-search-results {
    background-color: #fff;
    border: 0.0625rem solid #d9dee3;
    border-radius: 0.375rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.12);
}

.bank-search-results .list-group-item {
    border: none;
    border-bottom: 0.0625rem solid #f0f1f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.bank-search-results .list-group-item:last-child {
    border-bottom: none;
}

.bank-search-results .badge {
    flex-shrink: 0;
}


/* =====================================================================
   7. DATATABLES — busca, paginação e seletor de registros
   ===================================================================== */
.dataTables_wrapper .dataTables_filter {
    width: 100%;
}

.dataTables_wrapper .dataTables_filter label {
    width: 100%;
    margin: 0;
    position: relative;
}

.dataTables_wrapper .dataTables_filter input {
    width: 100%;
    border: 0.0625rem solid #d9dee3 !important;
    border-radius: 0.5rem !important;
    padding: 0.6rem 1rem 0.6rem 2.75rem !important;
    font-size: 0.9375rem !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: 1rem center !important;
    background-size: 0.9375rem 0.9375rem !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--moneta-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 59, 54, 0.15) !important;
    outline: none !important;
}

.dataTables_wrapper .dataTables_length {
    flex-shrink: 0;
}

.dataTables_wrapper .dataTables_length select {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%230D3B36' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 0.6875rem 0.6875rem;
    border: 0.0625rem solid #d9dee3;
    border-radius: 0.375rem;
    padding: 0.4rem 1.75rem 0.4rem 0.75rem;
    cursor: pointer;
    min-height: 2.625rem;
}

.dataTables_wrapper .dataTables_length select:hover {
    border-color: var(--moneta-primary);
}

.dataTables_wrapper .dataTables_paginate {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.dataTables_wrapper .dataTables_paginate .pagination {
    flex-wrap: nowrap;
    gap: 0.25rem;
}

.dataTables_wrapper .dataTables_paginate .page-link {
    min-width: 2.5rem;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    color: var(--moneta-primary);
    border: 0.0625rem solid #e7e7e7;
    font-weight: 500;
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    background-color: var(--moneta-primary);
    border-color: var(--moneta-primary);
    color: #fff;
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
    color: #c0c4c9;
    border-color: #f0f1f5;
}

.dataTables_wrapper .dataTables_paginate .page-link:hover {
    background-color: rgba(13, 59, 54, 0.08);
    border-color: var(--moneta-primary);
}

.dataTables_wrapper .dataTables_info {
    color: #6c757d;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.dataTables_wrapper {
    padding: 1.25rem 1.25rem 1rem;
}

table.table-datatable td:nth-child(2) {
    max-width: 20rem;
    white-space: normal;
    word-break: break-word;
}

table.table-datatable td[data-label="Valor"] {
    white-space: nowrap;
}


/* =====================================================================
   8. RESPONSIVIDADE MOBILE (breakpoint em em, respeita zoom de fonte)
   ===================================================================== */
@media (max-width: 47.9988em) {

    /* -------------------------------------------------------------
       8.1 Tabelas de listagem — cada linha vira um "card" empilhado,
       com rótulo (coluna 1) e valor (coluna 2) lado a lado via grid.
       O grid garante que texto longo QUEBRE em vez de estourar a
       largura (flexbox não garante isso pra texto sem elemento
       envolvendo, grid sim, por causa do minmax(0, 1fr)).
       Precisa de class="table-responsive-mobile" + data-label por
       célula na view; ver transactions/index.php como referência.
       ------------------------------------------------------------- */
    .table-responsive-mobile table,
    .table-responsive-mobile thead,
    .table-responsive-mobile tbody,
    .table-responsive-mobile th,
    .table-responsive-mobile tr {
        display: block;
    }

    .table-responsive-mobile thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table-responsive-mobile tbody tr {
        margin-bottom: 1rem;
        border: 0.0625rem solid #e7e7e7;
        border-radius: 0.75rem;
        padding: 1rem 1.25rem;
        background-color: #fff;
        box-shadow: 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.06);
    }

    .table-responsive-mobile tbody tr td {
        display: grid;
        grid-template-columns: minmax(5.5rem, auto) minmax(0, 1fr);
        align-items: start;
        text-align: right;
        padding: 0.65rem 0;
        border: none;
        border-bottom: 0.0625rem solid #f3f3f3;
        line-height: 1.5;
        gap: 0.75rem;
        word-break: break-word;
        overflow-wrap: break-word;
        white-space: normal !important;
    }

    .table-responsive-mobile tbody tr td:last-child {
        border-bottom: none;
    }

    .table-responsive-mobile tbody tr td::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        color: #6c757d;
        font-size: 0.8125rem;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .table-responsive-mobile tbody tr.table-empty-row td {
        display: block;
        text-align: center;
    }

    .table-responsive-mobile tbody tr.table-empty-row td::before {
        content: none;
    }

    .table-responsive-mobile tbody tr td[data-label="Ações"] {
        display: flex !important;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        gap: 0.5rem;
    }

    .table-responsive-mobile tbody tr td[data-label="Ações"]::before {
        content: none;
    }

    .table-responsive-mobile tbody tr.table-active {
        background-color: var(--moneta-primary-light);
        border: 0.125rem solid var(--moneta-primary);
    }

    .table-responsive-mobile tbody tr.table-active td {
        background-color: transparent !important;
        box-shadow: none !important;
    }

    /* -------------------------------------------------------------
       8.2 Tela de Perfil — abas rolam horizontalmente em vez de
       estourar a largura da tela.
       ------------------------------------------------------------- */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .nav-tabs .nav-item {
        flex-shrink: 0;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    /* -------------------------------------------------------------
       8.3 DataTables — seletor de registros com largura própria,
       segundo bloco de controles alinhado à esquerda.
       ------------------------------------------------------------- */
    .dataTables_wrapper .dataTables_length select {
        width: auto;
    }

    .dataTables_wrapper .dt-toolbar-bottom {
        align-items: flex-start !important;
    }
}

#terms-conditions.is-valid ~ .form-check-label,
#terms-conditions.is-invalid ~ .form-check-label {
    color: inherit !important;
}

#terms-conditions ~ .form-check-label a {
    color: var(--moneta-primary);
    text-decoration: underline;
    font-weight: 600;
}

#terms-conditions ~ .form-check-label a:hover {
    color: var(--moneta-primary-dark);
}

#terms-conditions.is-valid {
    border-color: #d9dee3;
    background-color: #fff;
}

#terms-conditions.is-valid:checked {
    border-color: var(--moneta-primary);
    background-color: var(--moneta-primary);
}

.flash-message-wrapper {
    min-width: 0;
    overflow: hidden;
}

.flash-message-wrapper .alert {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.9rem;
    margin: 0;
    font-size: 0.8125rem;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
}

.flash-message-wrapper .alert .btn-close {
    position: static !important;
    width: 0.6rem !important;
    height: 0.6rem !important;
    padding: 0.35rem !important;
    margin: 0 0 0 0.6rem !important;
    background-size: 0.5rem !important;
    flex-shrink: 0;
    opacity: 0.6;
}

@media (max-width: 47.9988em) {
    .flash-message-wrapper .alert {
        white-space: normal;
        border-radius: 0.5rem;
    }
}

@media (max-width: 47.9988em) {
    #modal-termos .modal-dialog {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        min-height: 100vh !important;
    }
    #modal-termos .modal-content {
        height: 100% !important;
        border: 0 !important;
        border-radius: 0 !important;
    }
    #modal-termos .modal-body {
        max-height: none !important;
        flex: 1 1 auto !important;
        overflow-y: auto !important;
    }
}