/* =================================================================
 * ROVERS UI TWEAKS — sobreposições seguras ao template NXL.
 *
 * Em caso de problemas: remover o <link> deste ficheiro no layout.php
 * e o sistema volta ao default sem efeitos secundários.
 *
 * Princípios:
 *  1) escala global da tipografia via `html { font-size: ... }`
 *     (afecta todo o `rem` automaticamente)
 *  2) layout do template usa `position: fixed` + `left: 280px`
 *     na topbar — temos de sobrepor `left`, não `margin-left`
 * ================================================================= */


/* =============================================================
 * 1. TIPOGRAFIA — escala global (rem-based)
 *
 * Template default: html = 16px, body = .84rem (~13.4px),
 *                   h3 = 1.275rem + .3vw (~22px), h5 = 1rem (~16px).
 * Após esta mudança: html = 13px → tudo encolhe ~19%.
 * ============================================================= */

html { font-size: 13px; }

/* Bootstrap headings usam calc(... + vw) que continua grande mesmo
 * com rem menor; forçamos valores fixos para o conteúdo. */
.main-content h1, .nxl-content h1 { font-size: 1.5rem !important;  line-height: 1.25; }
.main-content h2, .nxl-content h2 { font-size: 1.3rem !important;  line-height: 1.25; }
.main-content h3, .nxl-content h3 { font-size: 1.15rem !important; line-height: 1.25; }
.main-content h4, .nxl-content h4 { font-size: 1.05rem !important; line-height: 1.25; }
.main-content h5, .nxl-content h5 { font-size: 0.95rem !important; line-height: 1.3;  }
.main-content h6, .nxl-content h6 { font-size: 0.88rem !important; line-height: 1.3;  }

/* Page header — o h5 do template tem regra própria com border-right
 * de "separator" para o breadcrumb; mantemos só o tamanho. */
.page-header-title h5 {
    font-size: 1.05rem !important;
    margin-right: 8px;
    padding-right: 10px;
}
.page-header .breadcrumb { font-size: 0.78rem; margin-bottom: 0; }

/* Helpers fs-XX do template (eram px fixos visualmente grandes) */
.fs-11 { font-size: 0.7rem  !important; }
.fs-12 { font-size: 0.78rem !important; }
.fs-13 { font-size: 0.85rem !important; }
.fs-14 { font-size: 0.92rem !important; }
.fs-18 { font-size: 1.1rem  !important; }
.fs-20 { font-size: 1.2rem  !important; }


/* =============================================================
 * 2. LAYOUT — sidebar mais estreita (280 → 220)
 *
 * Topbar usa `position: fixed; left: 280px` no template —
 * temos de sobrepor `left`, não `margin-left`.
 * ============================================================= */

/* Estado normal — sidebar a 220px.
 * Quando `html.minimenu` está activo (toggle do botão na topbar), as regras
 * do template assumem (`.minimenu .nxl-navigation { width: 100px }` etc.). */
html:not(.minimenu) .nxl-navigation { width: 220px !important; }
html:not(.minimenu) .nxl-header     { left: 220px !important; }
html:not(.minimenu) .nxl-container  { margin-left: 220px !important; }
html:not(.minimenu) .page-header    { left: auto; }

/* Topbar/Container — altura reduzida (independente do estado mini) */
.nxl-header    { min-height: 56px !important; }
.nxl-container { top: 56px !important; min-height: calc(100vh - 56px) !important; }

/* Alinhamento interno: o template força os items do header a 79px
 * (linha vertical do avatar); reduzir para acompanhar a nova altura. */
.nxl-header .nxl-h-item { min-height: 55px !important; }

@media (max-width: 991.98px) {
    .nxl-header    { left: 0 !important; }
    .nxl-container { margin-left: 0 !important; }
}


/* =============================================================
 * 3. CONTEÚDO — paddings mais apertados
 * ============================================================= */

.nxl-content .main-content {
    padding-left: 18px !important;
    padding-right: 18px !important;
    padding-top: 18px !important;
}

.page-header {
    margin-bottom: 12px;
    padding: 0 18px;
}

.main-content .card .card-body {
    padding: 0.9rem 1rem;
}

.main-content .card .card-header {
    padding: 0.7rem 1rem;
    min-height: auto;
}


/* =============================================================
 * 4. TABELAS — denser rows
 * ============================================================= */

.main-content .table { margin-bottom: 0; }
.main-content .table > :not(caption) > * > * {
    padding: 8px 10px;
}
.main-content .table thead th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6c757d;
    font-weight: 600;
}


/* =============================================================
 * 5. SIDEBAR — escala texto à largura nova (220px)
 * ============================================================= */

.nxl-navigation .nxl-mtext         { font-size: 0.88rem; }
.nxl-navigation .nxl-caption label { font-size: 0.7rem;  letter-spacing: 0.4px; font-weight: 600; }
.nxl-navigation .nxl-link          { padding: 8px 14px; }
.nxl-navigation .nxl-micon         { font-size: 1rem; }
.nxl-navigation .nxl-submenu .nxl-link { padding-left: 38px; font-size: 0.82rem; }


/* =============================================================
 * 6. CONTROLOS — botões, forms, badges
 * ============================================================= */

.btn        { font-size: 0.88rem; padding: 0.4rem 0.85rem; }
.btn-sm     { font-size: 0.78rem; padding: 0.28rem 0.6rem; }
.btn-lg     { font-size: 0.95rem; padding: 0.55rem 1.1rem; }

.form-control, .form-select       { font-size: 0.88rem; padding: 0.4rem 0.65rem; }
.form-control-sm, .form-select-sm { font-size: 0.82rem; padding: 0.3rem 0.55rem; }
.form-label { font-size: 0.82rem; margin-bottom: 4px; font-weight: 500; }

.badge { font-size: 0.7rem; padding: 0.32em 0.6em; font-weight: 600; }


/* =============================================================
 * 7. MODAIS — tipografia coerente
 * ============================================================= */

.modal-header .modal-title { font-size: 1rem; font-weight: 600; }
.modal-body { padding: 1rem 1.1rem; }
.modal-footer { padding: 0.7rem 1rem; }


/* =============================================================
 * 8. THEME CUSTOMIZER (Aparência) — redesign moderno
 * ============================================================= */

/* No login (sem topbar/sidebar) o customizer não faz sentido.
 * :has é suportado em todos os browsers modernos (Chrome 105+, FF 121+, Safari 15.4+) */
body:has(.auth-minimal-wrapper) .theme-customizer { display: none !important; }

/* Trigger flutuante: pequeno, lateral, discreto */
.theme-customizer .customizer-handle {
    position: fixed !important;
    right: 0 !important;
    top: 40% !important;
    transform: translateY(-50%) !important;
    z-index: 1030;
}
.theme-customizer .cutomizer-open-trigger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: #fff !important;
    color: #6b7280 !important;
    border: 1px solid #e5e7eb;
    border-right: none;
    border-radius: 8px 0 0 8px;
    box-shadow: -2px 2px 10px rgba(0,0,0,.06);
    transition: all .2s ease;
}
.theme-customizer .cutomizer-open-trigger:hover {
    color: #3454d1 !important;
    background: #f0f6ff !important;
    width: 44px;
}
.theme-customizer .cutomizer-open-trigger i {
    font-size: 16px;
    line-height: 1;
}

/* Panel wrapper */
.customizer-sidebar-wrapper {
    width: 320px !important;
}

/* Header do panel */
.customizer-sidebar-header {
    padding: 14px 18px !important;
    height: auto !important;
    min-height: 56px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eef0f7 !important;
    background: #fff;
}
.customizer-sidebar-header h6 {
    font-size: 1rem !important;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.2;
}
.customizer-sidebar-header small {
    font-size: 0.72rem;
}
.cutomizer-close-trigger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: #6b7280;
    transition: all .15s ease;
}
.cutomizer-close-trigger:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* Body */
.customizer-sidebar-body {
    padding: 20px 18px !important;
}

/* Sections */
.customizer-section {
    margin-bottom: 22px;
}
.customizer-section:last-of-type {
    margin-bottom: 12px;
}
.customizer-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.customizer-section-title i {
    font-size: 14px;
    color: #9ca3af;
}

/* Radio cards modernos */
.customizer-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 14px 8px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all .15s ease;
    font-size: 0.82rem;
    color: #6b7280;
    font-weight: 500;
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    height: 100%;
}
.customizer-option i {
    font-size: 18px;
    line-height: 1;
}
.customizer-option:hover {
    border-color: #c7d2fe;
    background: #f5f8ff;
    color: #3454d1;
}
.btn-check:checked + .customizer-option {
    border-color: #3454d1;
    background: #eef4ff;
    color: #3454d1;
}
.btn-check:checked + .customizer-option i {
    color: #3454d1;
}

/* Footer */
.customizer-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #eef0f7;
}
.customizer-footer small {
    font-size: 0.72rem;
    color: #9ca3af;
}


/* =============================================================
 * 9. SKELETON LOADING — placeholder animado nas tabelas
 * ============================================================= */

.skeleton-bar {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #eef0f7 25%, #f6f7fb 50%, #eef0f7 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s linear infinite;
}
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* =============================================================
 * 10. TOPBAR (header) — escala interna
 * ============================================================= */

.nxl-header .header-wrapper { padding: 0 18px; }
.nxl-header .user-avtar     { width: 34px; height: 34px; }
.nxl-header h6              { font-size: 0.92rem; margin-bottom: 0; }
.nxl-header .dropdown-item  { font-size: 0.85rem; padding: 0.45rem 1rem; }
.nxl-header .dropdown-header h6 { font-size: 0.92rem; }
