/* ============================================================
   VELTRO WMS — Layout
   Sidebar, app-layout, header, banners, page, logo
   ============================================================ */

/* ── Page base ── */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
}

.page--operator {
    justify-content: flex-start;
    padding: 0;
}

.page--content {
    flex: 1;
    padding: 30px;
    background: var(--background);
    min-width: 0;
}

.page--content .footer {
    margin-top: auto;
}

/* ── App Layout ── */
.app-layout {
    display: flex;
    min-height: 100vh;
    margin-left: 240px;
}

/* ── Sidebar ── */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--accent);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar__brand {
    margin-bottom: 30px;
}

.sidebar__title {
    font-size: 20px;
    font-weight: 600;
}

.sidebar__subtitle {
    font-size: 13px;
    opacity: 0.7;
}

.sidebar__user {
    font-size: 13px;
    font-weight: 600;
    color: white;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
}

.sidebar__link {
    color: white;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 6px;
}

.sidebar__link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar__link--active {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar__footer {
    margin-top: auto;
}

.sidebar__logout {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    cursor: pointer;
}

.sidebar__logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn--sidebar {
    width: 100%;
    margin-top: 20px;
    color: white;
}

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

/* ── App Header ── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 20px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
}

/* ── Banner conexão ── */
.banner {
    padding: 8px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-left: 240px;
}

@media (max-width: 768px) {
    .banner {
        margin-left: 0;
    }
}

.banner__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.banner--online {
    background-color: #dcfce7;
    color: #166534;
}

.banner--online .banner__dot {
    background-color: #22c55e;
}

.banner--offline {
    background-color: #fee2e2;
    color: #991b1b;
}

.banner--offline .banner__dot {
    background-color: #ef4444;
}

.banner--warning {
    background-color: #fff7ed;
    color: #9a3412;
}

.banner--warning .banner__dot {
    background-color: #f97316;
}

/* ── Banner de feedback ── */
.send-banner {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    width: min(420px, calc(100vw - 32px));
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
}

.send-banner--hidden {
    display: none;
}

.send-banner--sent {
    background: #dcfce7;
    color: #166534;
}

.send-banner--offline {
    background: #fff7ed;
    color: #9a3412;
}

.send-banner--error {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Logo ── */
.sidebar__logo {
    max-width: 140px;
    height: auto;
    padding-bottom: 10px;
}

/* ── Responsividade ── */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

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

    .app-header__logo {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        width: 240px;
        height: 100vh;
        overflow-y: auto;
        transition: left 0.3s ease;
        z-index: 1000;
    }

    .sidebar--open {
        left: 0;
    }

    .page--content {
        padding: 16px;
        overflow-x: hidden;
        width: 100%;
        box-sizing: border-box;
    }

    .card--panel {
        min-height: auto;
    }

    /* Overlay quando sidebar está aberta */
    .sidebar--open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 240px;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        z-index: -1;
    }

    /* Filtros */
    .filters {
        /*flex-direction: column;*/
        width: 100%;
        overflow: hidden;
    }

    .filters select,
    .filters input {
        min-width: unset;
        width: 100%;
        box-sizing: border-box;
    }
}

/* ── App Header Actions ── */
.app-header--actions {
    justify-content: flex-end;
    gap: 12px;
}

.app-header__back {
    font-size: 13px;
    padding: 6px 12px;
    width: auto;
}

.app-header--mobile {
    justify-content: flex-start;
    align-items: center;
    position: relative;
    padding-bottom: 20px;
}

.app-header__logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    max-height: 43px;
    width: auto;
}

/* ── Sidebar hierárquica ── */
.sidebar__group {
    margin-bottom: 4px;
}

.sidebar__group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: white;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.7;
    transition: background 0.2s, opacity 0.2s;
    user-select: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar__group-header:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.sidebar__group-header--active {
    opacity: 1;
}

.sidebar__group-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.8;
}

.sidebar__group-arrow {
    margin-left: auto;
    transition: transform 0.2s;
    opacity: 0.6;
    font-size: 10px;
}

.sidebar__group-arrow--open {
    transform: rotate(180deg);
}

.sidebar__group-links {
    display: none;
    flex-direction: column;
    padding-left: 12px;
    margin-top: 2px;
}

.sidebar__group-links--open {
    display: flex;
}

.sidebar__group-link {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.2s, color 0.2s;
}

.sidebar__group-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar__group-link--active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 600;
}

/* ── Painel Admin link fixo ── */
.sidebar__admin-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.sidebar__admin-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar__admin-link--active {
    background: rgba(255, 255, 255, 0.2);
}

/* ── Divisor ── */
.sidebar__divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 12px 0;
}

/* ── Botão Sair ── */
.sidebar__logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-align: left;
}

.sidebar__logout:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

#sidebarOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 240px;
    width: calc(100vw - 240px);
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1001;
}

#sidebarOverlay.active {
    display: block;
}

@media (min-width: 769px) {
    .app-header__logo {
        display: none;
    }
}
