/**
 * assets/style.css — Estilos customizados do InternarHSE
 * Layout com sidebar lateral fixa + navbar no topo
 */

/* ═══════════════════════════════════════════════
   Reset / Base
══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f8;
    margin: 0;
    padding: 0;
}

/* ═══════════════════════════════════════════════
   NAVBAR TOPO
══════════════════════════════════════════════════ */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #0d6efd;
    z-index: 1040;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.top-navbar-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 16px;
    gap: 10px;
}

/* Botão hamburger */
.sidebar-toggle-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.15s;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Marca/Logo na navbar */
.top-navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.top-navbar-brand:hover {
    color: rgba(255, 255, 255, 0.85);
}

/* Dropdown do usuário */
.top-navbar-user .btn-link {
    color: #fff !important;
}

.top-navbar-user .dropdown-menu {
    border-radius: 0.75rem;
    min-width: 220px;
}

/* ═══════════════════════════════════════════════
   LAYOUT WRAPPER
══════════════════════════════════════════════════ */
#layoutWrapper {
    display: flex;
    min-height: 100vh;
    padding-top: 56px; /* altura da navbar */
}

/* ═══════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════ */
#sidebar {
    width: 255px;
    min-width: 255px;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    background: #1a2236;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1030;
    transition: transform 0.25s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

/* ── Perfil do usuário na sidebar ── */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 16px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.sidebar-profile-avatar {
    font-size: 2.2rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-profile-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile-role {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.72rem;
    margin-top: 2px;
}

/* ── Navegação ── */
.sidebar-nav {
    flex: 1;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
}

.sidebar-section-label {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 1.3px;
    color: rgba(255, 255, 255, 0.28);
    text-transform: uppercase;
    padding: 14px 20px 5px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.62);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    margin: 1px 0;
}

.sidebar-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    border-left-color: rgba(255, 255, 255, 0.25);
}

.sidebar-link.active {
    color: #fff;
    background: rgba(13, 110, 253, 0.22);
    border-left-color: #4d94ff;
}

/* ── Rodapé da sidebar ── */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding: 8px 0;
    flex-shrink: 0;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255, 120, 120, 0.75);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.sidebar-logout i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

.sidebar-logout:hover {
    color: #ff7b7b;
    background: rgba(255, 100, 100, 0.08);
}

/* ═══════════════════════════════════════════════
   OVERLAY MOBILE
══════════════════════════════════════════════════ */
#sidebarOverlay {
    display: none;
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1025;
    cursor: pointer;
}

#sidebarOverlay.show {
    display: block;
}

/* ═══════════════════════════════════════════════
   CONTEÚDO PRINCIPAL
══════════════════════════════════════════════════ */
#mainContent {
    flex: 1;
    margin-left: 255px;
    padding: 1.75rem;
    min-height: calc(100vh - 56px);
    background: #f0f2f8;
    transition: margin-left 0.25s ease;
}

/* ═══════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════ */
.app-footer {
    margin-left: 255px;
    background: #fff;
    border-top: 1px solid #e9ecef;
    font-size: 0.8rem;
    transition: margin-left 0.25s ease;
}

/* ═══════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════ */
.card {
    border-radius: 0.875rem;
}

.card-header {
    border-radius: 0.875rem 0.875rem 0 0 !important;
}

/* ═══════════════════════════════════════════════
   TABELAS
══════════════════════════════════════════════════ */
.table thead th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    vertical-align: middle;
}

.table tbody td {
    font-size: 0.9rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.04);
}

/* ═══════════════════════════════════════════════
   FORMULÁRIOS
══════════════════════════════════════════════════ */
.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-check.border {
    transition: background-color 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
    background-color: #f8f9fa;
}

.form-check.border:hover {
    background-color: #e9ecef !important;
    border-color: #adb5bd !important;
}

.form-check.border:has(input:checked) {
    background-color: rgba(25, 135, 84, 0.08) !important;
    border-color: #198754 !important;
}

.form-check.border input[type="checkbox"] {
    width: 1.15em;
    height: 1.15em;
    accent-color: #198754;
}

/* ── Checklist cards (cadastrar/editar) ── */
.checklist-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    height: 100%;
    width: 100%;
    border: 2px solid #dee2e6;
    border-radius: 0.625rem;
    background: #f8f9fa;
    cursor: pointer;
    margin: 0;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

.checklist-card:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.checklist-card input[type="checkbox"] {
    width: 1.1em;
    height: 1.1em;
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
    accent-color: #198754;
}

.checklist-card:has(input:checked) {
    background-color: rgba(25, 135, 84, 0.08);
    border-color: #198754;
}

/* ═══════════════════════════════════════════════
   BOTÕES
══════════════════════════════════════════════════ */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
}

.btn-sm {
    border-radius: 0.4rem;
}

/* ═══════════════════════════════════════════════
   ALERTAS
══════════════════════════════════════════════════ */
.alert {
    border-radius: 0.75rem;
}

/* ═══════════════════════════════════════════════
   SIDEBAR RECOLHIDA — toggle (desktop e tablet)
══════════════════════════════════════════════════ */
body.sidebar-collapsed #sidebar {
    transform: translateX(-255px);
}

body.sidebar-collapsed #mainContent {
    margin-left: 0;
}

body.sidebar-collapsed .app-footer {
    margin-left: 0;
}

/* ═══════════════════════════════════════════════
   RESPONSIVIDADE — Tablet e Mobile (< 992px)
══════════════════════════════════════════════════ */
@media (max-width: 991.98px) {

    /* Sidebar oculta por padrão no mobile */
    #sidebar {
        transform: translateX(-100%);
    }

    /* Sidebar visível quando classe .show ativa */
    #sidebar.show {
        transform: translateX(0);
    }

    /* Conteúdo ocupa tudo sem margem de sidebar */
    #mainContent {
        margin-left: 0;
        padding: 1.25rem;
    }

    .app-footer {
        margin-left: 0;
    }
}

@media (max-width: 576px) {
    #mainContent {
        padding: 1rem 0.75rem;
    }

    h4.fw-bold {
        font-size: 1.05rem;
    }

    .btn-sm {
        padding: 0.2rem 0.45rem;
        font-size: 0.75rem;
    }
}

/* ═══════════════════════════════════════════════
   IMPRESSÃO — oculta sidebar, navbar e footer
══════════════════════════════════════════════════ */
@media print {
    .no-print,
    #sidebar,
    #sidebarOverlay,
    .top-navbar,
    .app-footer,
    .btn,
    button,
    .alert {
        display: none !important;
    }

    #layoutWrapper {
        padding-top: 0;
    }

    #mainContent {
        margin-left: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    body {
        background: #fff !important;
        font-size: 11pt;
    }

    .card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    a {
        text-decoration: none !important;
        color: inherit !important;
    }
}
