/* CCB Visual Identity Overrides for Preset-10 and Root */
:root,
[data-pc-preset="preset-10"] {
    /* Font family override */
    --bs-body-font-family: Verdana, Geneva, sans-serif !important;

    /* Primary brand colors (CCB Azul Escuro) */
    --bs-primary: #033D60 !important;
    --bs-primary-rgb: 3, 61, 96 !important;
    --bs-primary-light: #e6ecf0 !important;
    /* tom claro de azul escuro */
    --bs-link-color: #033D60 !important;
    --bs-link-color-rgb: 3, 61, 96 !important;
    --bs-link-hover-color: #02253a !important;
    --bs-link-hover-color-rgb: 2, 37, 58 !important;
    --pc-sidebar-active-color: #033D60 !important;

    /* Secondary/Status Colors */
    --bs-success: #5DB196 !important;
    --bs-success-rgb: 93, 177, 150 !important;

    --bs-warning: #FFCC66 !important;
    --bs-warning-rgb: 255, 204, 102 !important;

    --bs-danger: #DC3C00 !important;
    --bs-danger-rgb: 220, 60, 0 !important;

    --bs-info: #98CDBD !important;
    --bs-info-rgb: 152, 205, 189 !important;

    --bs-secondary: #49656C !important;
    --bs-secondary-rgb: 73, 101, 108 !important;

    --bs-dark: #033D60 !important;
    --bs-dark-rgb: 3, 61, 96 !important;

    --bs-gray-300: #CDD4DC !important;
    --bs-gray-500: #A5A5A5 !important;

    /* Sidebar / Brand Header Customization */
    --pc-brand-background: #02253a !important;
    --pc-sidebar-background: #033D60 !important;
    --pc-sidebar-caption-color: #CDD4DC !important;

    /* Top Header Dark Mode Colors */
    --pc-header-background: #033D60 !important;
    --pc-header-color: #ffffff !important;
}

body {
    font-family: Verdana, Geneva, sans-serif !important;
}

/* Button overrides for standard elements */
.btn-primary {
    --bs-btn-color: #ffffff !important;
    --bs-btn-bg: #033D60 !important;
    --bs-btn-border-color: #033D60 !important;
    --bs-btn-hover-color: #ffffff !important;
    --bs-btn-hover-bg: #02253a !important;
    --bs-btn-hover-border-color: #02253a !important;
    --bs-btn-focus-shadow-rgb: 3, 61, 96 !important;
    --bs-btn-active-color: #ffffff !important;
    --bs-btn-active-bg: #02253a !important;
    --bs-btn-active-border-color: #02253a !important;
}

.btn-light-primary {
    background: #e6ecf0 !important;
    color: #033D60 !important;
    border-color: #e6ecf0 !important;
}

.btn-light-primary:hover,
.btn-light-primary:focus,
.btn-light-primary:active {
    background: #033D60 !important;
    color: #ffffff !important;
    border-color: #033D60 !important;
}

.btn-link-primary {
    color: #033D60 !important;
}

.btn-link-primary:hover {
    color: #02253a !important;
}

/* Sidebar active navigation styling */
.pc-sidebar,
[data-pc-sidebar-theme="dark"] .pc-sidebar {
    background-color: #033D60 !important;
    background: #033D60 !important;
}

.pc-sidebar .m-header,
[data-pc-sidebar-theme="dark"] .pc-sidebar .m-header {
    background-color: #02253a !important;
    background: #02253a !important;
}

.pc-sidebar .pc-navbar .pc-item.active>.pc-link {
    background: linear-gradient(135deg, #055a8c 0%, #02253a 100%) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

.pc-sidebar .pc-navbar .pc-item .pc-link:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.03) 100%) !important;
    color: #ffffff !important;
}

.pc-sidebar .pc-navbar .pc-item.active>.pc-link:hover {
    background: linear-gradient(135deg, #0667a0 0%, #022d46 100%) !important;
    color: #ffffff !important;
}

/* Accordion highlight styling */
.accordion {
    --bs-accordion-btn-focus-border-color: #033D60 !important;
    --bs-accordion-active-color: #033D60 !important;
    --bs-accordion-active-bg: #e6ecf0 !important;
}

/* List group overrides */
.list-group {
    --bs-list-group-active-bg: #033D60 !important;
    --bs-list-group-active-border-color: #033D60 !important;
}

/* Progress bar bg override */
.progress {
    --bs-progress-bar-bg: #033D60 !important;
}

/* Accent Card gradients (Dashboard stats) */
.bg-grd-primary {
    background: linear-gradient(135deg, #033D60 0%, #49656C 100%) !important;
}

.bg-grd-success {
    background: linear-gradient(135deg, #5DB196 0%, #98CDBD 100%) !important;
}

.bg-grd-warning {
    background: linear-gradient(135deg, #DC3C00 0%, #FFCC66 100%) !important;
}

.bg-grd-info {
    background: linear-gradient(135deg, #98CDBD 0%, #49656C 100%) !important;
}

/* Alert styling overrides */
.alert-success {
    border-left: 5px solid #5DB196 !important;
    background-color: rgba(93, 177, 150, 0.15) !important;
    color: #02253a !important;
}

.alert-danger {
    border-left: 5px solid #DC3C00 !important;
    background-color: rgba(220, 60, 0, 0.1) !important;
    color: #DC3C00 !important;
}

.alert-warning {
    border-left: 5px solid #FFCC66 !important;
    background-color: rgba(255, 204, 102, 0.15) !important;
    color: #5d4300 !important;
}

/* Links color override inside tables/cards */
.link-primary {
    color: #033D60 !important;
}

.link-primary:hover,
.link-primary:focus {
    color: #02253a !important;
}

/* Badges override */
.badge.bg-primary {
    background-color: #033D60 !important;
    color: #ffffff !important;
}

.badge.bg-success {
    background-color: #5DB196 !important;
    color: #ffffff !important;
}

.badge.bg-warning {
    background-color: #FFCC66 !important;
    color: #201E1E !important;
}

.badge.bg-danger {
    background-color: #DC3C00 !important;
    color: #ffffff !important;
}

.card,
.card.bg-primary,
.card.card-border-primary {
    border-top: 4px solid #36baee !important;
}

.card-header,
.card-header.bg-dark,
.card-header.bg-light {
    background-color: #033D60 !important;
    background: #033D60 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;

}

.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6,
.card-header p,
.card-header span,
.card-header i {
    color: #ffffff !important;
}

/* Garante que os botões dentro do card-header fiquem destacados no fundo azul */
.card-header .btn-primary {
    background-color: #02253a !important;
    border-color: #02253a !important;
    color: #ffffff !important;
}

.card-header .btn-primary:hover {
    background-color: #011522 !important;
    border-color: #011522 !important;
}

/* Choices.js custom style overrides for CCB theme */
.choices {
    margin-bottom: 0;
}

.choices__inner {
    border: 1px solid #dee2e6 !important;
    background-color: #fff !important;
    border-radius: 6px !important;
    min-height: 38px !important;
    padding: 4px 8px !important;
    font-family: inherit !important;
    font-size: 0.9rem !important;
    display: flex;
    align-items: center;
}

.choices__list--single {
    padding: 0 !important;
}

.choices__list--dropdown {
    border-radius: 6px !important;
    border-color: #dee2e6 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    z-index: 1050 !important;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: #e6ecf0 !important;
    color: #033D60 !important;
}

.choices__list--dropdown .choices__item--selectable.is-selected {
    background-color: #033D60 !important;
    color: #ffffff !important;
}

/* Choices validation state styling */
.choices.is-invalid .choices__inner {
    border-color: #DC3C00 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23DC3C00'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23DC3C00' stroke='none'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 30px center !important;
    background-size: 16px 16px !important;
    padding-right: 50px !important;
}

[data-pc-direction=ltr] .rounded-circle {
    background: #36baee !important;
}

/* Responsive pagination styling */
nav.d-flex.justify-content-between.align-items-center {
    flex-wrap: wrap !important;
    flex-direction: column !important;
    gap: 12px !important;
}

@media (min-width: 768px) {
    nav.d-flex.justify-content-between.align-items-center {
        flex-direction: row !important;
        gap: 0 !important;
    }
}

.pagination {
    flex-wrap: wrap !important;
    justify-content: center !important;
    margin-bottom: 0 !important;
}

/* Fix SweetAlert2 Toast container blocking clicks and displaying backdrop */
body.swal2-toast-shown .swal2-container {
    pointer-events: none !important;
    background: transparent !important;
    background-color: transparent !important;
}

body.swal2-toast-shown .swal2-container .swal2-popup.swal2-toast {
    pointer-events: auto !important;
}

/* Evitar transbordo horizontal (scroll lateral) em telas menores/com zoom */
html, body {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* Garantir que controles de formulário respeitem a largura do contêiner */
.form-select, .form-control, .choices, .choices__inner {
    max-width: 100% !important;
}

/* Ajustes de responsividade específicos para smartphones (até 576px) */
@media (max-width: 576px) {
    /* Diminuir o tamanho do seletor de tenant (localidade) no cabeçalho */
    #tenant-selector-form select.form-select {
        max-width: 150px !important;
        font-size: 11px !important;
        padding: 4px 18px 4px 6px !important;
        height: auto !important;
        min-height: auto !important;
    }

    #tenant-selector-form .input-group-text {
        padding: 4px 6px !important;
        font-size: 11px !important;
    }

    /* Reduzir margens e paddings no cabeçalho superior */
    .pc-header .header-wrapper {
        padding: 0 8px !important;
    }

    .pc-header .pc-h-item {
        margin-right: 6px !important;
    }

    /* Assegurar que as células de tabelas não quebrem letra por letra e rolem horizontalmente */
    table.table td, table.table th {
        white-space: nowrap !important;
        word-break: normal !important;
    }

    /* Ajuste responsivo dos cabeçalhos dos cartões com controles e ações no mobile */
    .card-header.d-flex.align-items-center.justify-content-between {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    .card-header.d-flex.align-items-center.justify-content-between h4,
    .card-header.d-flex.align-items-center.justify-content-between h5 {
        width: 100% !important;
        margin-bottom: 0 !important;
        white-space: normal !important;
        font-size: 1.15rem !important;
    }

    .card-header.d-flex.align-items-center.justify-content-between > div.d-flex,
    .card-header.d-flex.align-items-center.justify-content-between > .d-flex {
        width: 100% !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
}

/* Layout View Switcher (Table vs Cards) */
.view-table, .view-cards {
    transition: opacity 0.25s ease-in-out;
}

@media (min-width: 768px) {
    .view-cards {
        display: none !important;
    }
    .view-table {
        display: block !important;
    }
    
    body.layout-pref-cards .view-cards {
        display: block !important;
    }
    body.layout-pref-cards .view-table {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .view-cards {
        display: block !important;
    }
    .view-table {
        display: none !important;
    }
    
    body.layout-pref-table .view-cards {
        display: none !important;
    }
    body.layout-pref-table .view-table {
        display: block !important;
    }

    /* Responsividade para o rodapé do modal de detalhes de agendamento */
    #modalDetalhesAgendamento .modal-footer {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        padding: 15px !important;
    }
    
    #modalDetalhesAgendamento .modal-footer > div:first-child {
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
    }
    
    #modalDetalhesAgendamento .modal-footer #form-excluir {
        width: 100% !important;
    }

    #modalDetalhesAgendamento .modal-footer #btn-excluir-agendamento {
        width: 100% !important;
    }

    #modalDetalhesAgendamento .modal-footer #buttons-normal-container {
        flex-direction: column !important;
        width: 100% !important;
        gap: 8px !important;
    }

    #modalDetalhesAgendamento .modal-footer #buttons-normal-container .btn,
    #modalDetalhesAgendamento .modal-footer #buttons-normal-container .dropdown {
        width: 100% !important;
    }
    
    #modalDetalhesAgendamento .modal-footer #buttons-normal-container .dropdown .btn {
        width: 100% !important;
    }
}