/*
 * Base structure
 */

html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
}

.cover-container {
    flex: 1;
    min-height: 100vh;
}

.cover-container > nav {
    flex: none;
}

.cover-container > .container-fluid {
    flex: 1 0 auto;
}

.cover-container > footer {
    flex: none;
}

/*
 * Navbar
 */
.navbar {
    min-height: 56px;
    border-bottom: 1px solid var(--bs-border-color);
}

.localization-icons img {
    width: 21px;
    opacity: 0.3;
}

.localization-icons img:hover,
.localization-icons img.active {
    opacity: 1;
}

/*
 * App Layout (Sidebar + Content)
 */
.app-layout {
    display: flex;
    min-height: calc(100vh - 56px - 40px); /* viewport - navbar - footer */
}

/* ---- Sidebar ---- */
.app-sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.22s ease, min-width 0.22s ease;
    overflow: hidden;
    z-index: 100;
}

.app-sidebar.collapsed {
    width: 56px;
    min-width: 56px;
}

.sidebar-header {
    min-height: 48px;
    border-bottom: 1px solid var(--bs-border-color);
}

.app-sidebar.collapsed .sidebar-label,
.app-sidebar.collapsed .sidebar-item-label,
.app-sidebar.collapsed .sidebar-section-label {
    display: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    flex: 1;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--bs-body-color);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 0;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.sidebar-item:hover {
    background: var(--bs-secondary-bg);
    color: var(--bs-primary);
}

.sidebar-item.active {
    color: var(--bs-primary);
    background: color-mix(in srgb, var(--bs-primary) 10%, transparent);
    font-weight: 600;
    border-left: 3px solid var(--bs-primary);
}

.sidebar-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    color: var(--bs-secondary-color);
}

.sidebar-item.active i {
    color: var(--bs-primary);
}

.sidebar-divider {
    height: 1px;
    background: var(--bs-border-color);
    margin: 4px 0;
}

/* Keep icon centered when collapsed */
.app-sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: 9px 0;
    border-left-color: transparent;
}

.app-sidebar.collapsed .sidebar-item.active {
    border-left: 3px solid var(--bs-primary);
}

/* ---- Main Content ---- */
.app-content {
    flex: 1;
    min-width: 0;
    background: var(--bs-body-bg);
}

/*
 * KPI Cards
 */
.kpi-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
}

.kpi-card.active-filter {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    width: 36px;
    height: 36px;
}

/*
 * Table
 */
.table th {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
}

.table-header-sticky th {
    position: sticky;
    top: 0;
    background: var(--bs-body-bg);
    z-index: 1;
    border-bottom: 2px solid var(--bs-border-color);
}

.pedido-row {
    transition: background 0.12s ease;
}

/**
 * Social Buttons
 */
.btn-social:hover {
    opacity: 0.85;
    text-decoration: none;
}

.btn-facebook, .btn-facebook:hover { color: #3B5998; }
.btn-twitter,  .btn-twitter:hover  { color: #55ACEE; }
.btn-google,   .btn-google:hover   { color: #dd4b39; }

/**
 * Login Page Form Wrapper
 */
.form-wrapper { display: none; }
.form-wrapper.active { display: block; }

/**
 * Misc
 */
.page-header small { font-size: 1rem; }
.blockquote { font-size: 1rem; }

.dropdown-item i {
    color: var(--bs-secondary-color);
}

label .required {
    color: var(--bs-danger);
}

.table-responsive {
    min-height: 200px;
}

dt { font-weight: 400 !important; }
dd { font-weight: 700; }

/**
 * Responsive
 */
@media (max-width: 768px) {
    .app-sidebar {
        width: 56px;
        min-width: 56px;
    }

    .app-sidebar .sidebar-label,
    .app-sidebar .sidebar-item-label,
    .app-sidebar .sidebar-section-label {
        display: none;
    }

    .app-sidebar .sidebar-item {
        justify-content: center;
        padding: 9px 0;
    }

    .localization-icons {
        margin-top: 15px;
        margin-bottom: 10px;
        display: flex !important;
        justify-content: space-evenly;
    }
}

@media (min-width: 992px) {
    .table-responsive {
        overflow-x: auto;
    }
}
/* ── WMS — Mapa de Armazém ─────────────────────────────────── */
.wms-mapa-container .card-header {
    background: var(--bs-secondary-bg);
    font-size: .8rem;
}

.wms-loc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    font-size: .7rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform .1s, box-shadow .1s;
    user-select: none;
    position: relative;
}

.wms-loc:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
    z-index: 1;
}

/* Contador de produtos numa localização com mais de um item */
.wms-loc-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    font-size: .55rem;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    color: #fff;
    background-color: #0d6efd;
    border-radius: 8px;
    box-shadow: 0 0 0 1px #fff;
}

.wms-loc-ocupado {
    background-color: #198754;
    color: #fff;
    border-color: #157347;
}

.wms-loc-baixo {
    background-color: #ffc107;
    color: #000;
    border-color: #e0a800;
}

.wms-loc-vazio {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    border-color: var(--bs-border-color);
}

/* ── Cabeçalho de tabela ordenável (dashboard) ───────────────── */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
th.sortable:hover {
    color: var(--bs-primary);
}
th.sortable::after {
    content: "\f0dc"; /* fa-sort */
    font-family: "FontAwesome";
    font-weight: 900;
    margin-left: 6px;
    opacity: .35;
    font-size: .8em;
}
th.sortable.asc::after {
    content: "\f0de"; /* fa-sort-asc */
    opacity: .9;
}
th.sortable.desc::after {
    content: "\f0dd"; /* fa-sort-desc */
    opacity: .9;
}
