/* NUTRIAQUA — Estilos Customizados e Design System Institucional */

:root {
    --sidebar-width: 190px;
    /* Preservação de retrocompatibilidade com token histórico E2: --sidebar-width: 250px; */
    --sidebar-bg: #0c1a30;
    --sidebar-text: #cbd5e1;
    --sidebar-text-hover: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: #0d6efd;
    --sidebar-active-text: #ffffff;

    --header-height: 60px;
    --header-bg: #ffffff;
    --header-border: #e2e8f0;

    --body-bg: #f4f6f9;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;

    --color-primary: #0d6efd;
    --color-success: #198754;
    --color-warning: #f59e0b;
    --color-danger: #dc3545;
    --color-info: #06b6d4;
}

body {
    background-color: var(--body-bg);
    color: #1e293b;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   ACESSIBILIDADE: SKIP LINK
   ============================================================ */
.skip-link {
    position: absolute;
    top: -60px;
    left: 10px;
    padding: 10px 15px;
    background-color: var(--color-primary);
    color: #fff;
    font-weight: 600;
    z-index: 2100;
    border-radius: 0 0 0.375rem 0.375rem;
    text-decoration: none;
    transition: top 0.15s ease-in-out;
}

.skip-link:focus {
    top: 0;
    color: #fff;
    outline: 3px solid #ffc107;
}

#main-content:focus {
    outline: none;
}

/* ============================================================
   ESTRUTURA GERAL COM MENU LATERAL (SIDEBAR)
   ============================================================ */
.app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.25s ease-in-out;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
    padding: 0.95rem 0.85rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background-color: rgba(0, 0, 0, 0.15);
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #ffffff;
    line-height: 1.15;
}

.brand-subtitle {
    font-size: 0.65rem;
    color: #94a3b8;
    line-height: 1.1;
    margin-top: 1px;
    white-space: nowrap;
}

.sidebar-nav {
    padding: 0.65rem 0.5rem;
    flex: 1 1 auto;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sidebar-menu .nav-item {
    margin-bottom: 1px;
}

.sidebar-menu .nav-link {
    color: var(--sidebar-text);
    padding: 0.52rem 0.65rem;
    border-radius: 0.375rem;
    font-size: 0.835rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    white-space: nowrap;
}

.sidebar-menu .nav-link i {
    font-size: 1.05rem;
    margin-right: 0.5rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-menu .nav-link:hover {
    color: var(--sidebar-text-hover);
    background-color: var(--sidebar-hover-bg);
}

.sidebar-menu .nav-link.active {
    color: var(--sidebar-active-text);
    background-color: var(--sidebar-active-bg);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.sidebar-menu .chevron-icon {
    font-size: 0.7rem;
    transition: transform 0.2s ease, opacity 0.2s ease;
    margin-right: 0;
    width: auto;
    opacity: 0.5;
    flex-shrink: 0;
}

.sidebar-menu .nav-link:hover .chevron-icon {
    opacity: 0.95;
    transform: translateX(2px);
}

.sidebar-menu .has-submenu > .nav-link:not(.collapsed) .chevron-icon {
    transform: rotate(90deg);
    opacity: 0.9;
}

.submenu-collapse .nav-link {
    padding: 0.38rem 0.5rem 0.38rem 1.95rem;
    font-size: 0.785rem;
    color: #94a3b8;
    border-radius: 0.375rem;
    white-space: nowrap;
}

.submenu-collapse .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

/* ============================================================
   ILUSTRAÇÃO E WIDGET DA ESCOLA NA SIDEBAR
   ============================================================ */
.sidebar-school-widget {
    margin-top: auto;
    padding: 0 0.5rem 0.35rem;
}

.school-widget-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.6) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.625rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
    padding: 0.45rem !important;
}

.school-illustration-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
}

.school-illustration-svg {
    max-width: 135px;
    height: auto;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.3));
}

.sidebar-school-tagline {
    line-height: 1.2;
}

.sidebar-school-tagline .small {
    font-size: 0.76rem;
}

.sidebar-footer {
    padding: 0.55rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
}

.sidebar-footer-text {
    font-size: 0.68rem;
    color: #94a3b8;
    letter-spacing: 0.03em;
}

/* Backdrop para mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(12, 26, 48, 0.65);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

/* ============================================================
   CONTAINER PRINCIPAL E CABEÇALHO SUPERIOR
   ============================================================ */
.app-main-layout {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--body-bg);
    transition: margin-left 0.25s ease-in-out;
}

.app-header {
    height: var(--header-height);
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.header-date {
    font-size: 0.825rem;
    color: #64748b;
    font-weight: 500;
}

.user-avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
}

.user-nome-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
}

.user-meta-header {
    display: flex;
    align-items: center;
    margin-top: 1px;
}

.user-role-text {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.user-escopo-badge {
    font-size: 0.65rem;
    font-weight: 600;
    background-color: #e2e8f0;
    color: #475569;
    border-radius: 4px;
    padding: 2px 5px;
    letter-spacing: 0.03em;
}

.user-badge-perfil,
.user-badge-escopo {
    font-size: 0.7rem;
    font-weight: 600;
    vertical-align: middle;
    letter-spacing: 0.03em;
}

.user-dropdown-toggle:hover {
    opacity: 0.85;
}

.dropdown-menu {
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

.dropdown-item {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.app-content-body {
    flex: 1 1 auto;
}

/* ============================================================
   RESPONSIVIDADE (MOBILE / TABLET)
   ============================================================ */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    }

    .sidebar-backdrop.show {
        display: block;
    }

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

/* ============================================================
   BARRA DE FILTROS DO DASHBOARD
   ============================================================ */
.filter-bar-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background-color: #ffffff;
}

.filter-bar-card .form-control {
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #374151;
}

.filter-bar-card .btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    border-radius: 0.375rem;
    font-weight: 500;
}

.filter-bar-card .btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.filter-bar-card .btn-outline-secondary {
    border-color: #d1d5db;
    color: #4b5563;
    border-radius: 0.375rem;
    font-weight: 500;
}

.filter-bar-card .btn-outline-secondary:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
    color: #1f2937;
}

/* ============================================================
   CARDS DE INDICADORES (KPIS NO TOPO DO DASHBOARD)
   ============================================================ */
.kpi-card {
    border: none;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.kpi-card .card-body {
    padding: 1.15rem 1.25rem;
    position: relative;
    z-index: 1;
}

.kpi-title {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: capitalize;
    margin-bottom: 0.35rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.kpi-subtext {
    font-size: 0.75rem;
    opacity: 0.9;
}

.kpi-watermark-icon {
    position: absolute;
    right: 1rem;
    bottom: 0.75rem;
    font-size: 2.25rem;
    opacity: 0.22;
    pointer-events: none;
}

/* Cores específicas de KPI alinhadas com a referência institucional */
.card.kpi-card-green,
.kpi-card-green {
    background-color: var(--color-success);
    color: #ffffff;
}

.card.kpi-card-blue,
.kpi-card-blue {
    background-color: var(--color-primary);
    color: #ffffff;
}

.card.kpi-card-cyan,
.kpi-card-cyan {
    background-color: var(--color-info);
    color: #ffffff;
}

.card.kpi-card-red,
.kpi-card-red {
    background-color: var(--color-danger);
    color: #ffffff;
}

.card.kpi-card-amber,
.kpi-card-amber {
    background-color: var(--color-warning);
    color: #ffffff;
}

.card.kpi-card-neutral,
.kpi-card-neutral {
    background-color: #ffffff;
    color: #0f172a;
    border: 1px solid var(--card-border);
}

.kpi-card-neutral .kpi-title {
    color: #64748b;
}

.kpi-card-neutral .kpi-subtext {
    color: #64748b;
    opacity: 1;
}

.kpi-card-neutral .kpi-watermark-icon {
    color: #94a3b8;
    opacity: 0.35;
}

/* ============================================================
   CARD SITUAÇÃO DO ESTOQUE (DONUT CHART)
   ============================================================ */
.donut-chart-container {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 0 auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.donut-hole {
    position: absolute;
    top: 25%;
    left: 25%;
    width: 50%;
    height: 50%;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.05);
}

.donut-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.6rem;
    flex-shrink: 0;
}

/* ============================================================
   ACESSO RÁPIDO E ATALHOS OPERACIONAIS
   ============================================================ */
.btn-quick-access {
    border: 1px solid #0d6efd;
    color: #0d6efd;
    background-color: #ffffff;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    margin-bottom: 0.5rem;
    width: 100%;
}

.btn-quick-access:hover {
    background-color: #f0f7ff;
    border-color: #0b5ed7;
    color: #0b5ed7;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.12);
    transform: translateX(2px);
}

.btn-quick-access:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

.btn-quick-access i {
    font-size: 1rem;
    margin-right: 0.65rem;
    color: #0d6efd;
}

/* Card em grade horizontal de acesso rápido (E3) */
.btn-quick-access.quick-access-grid-card {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1.15rem 0.75rem;
    border-radius: 0.625rem;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin-bottom: 0;
    transition: all 0.2s ease-in-out;
}

.btn-quick-access.quick-access-grid-card i {
    font-size: 1.65rem;
    margin-right: 0;
    margin-bottom: 0.5rem;
    color: #0d6efd;
    transition: transform 0.2s ease;
}

.btn-quick-access.quick-access-grid-card span {
    font-size: 0.825rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.25;
}

.btn-quick-access.quick-access-grid-card:hover {
    border-color: #0d6efd;
    background-color: #f8faff;
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(13, 110, 253, 0.15);
}

.btn-quick-access.quick-access-grid-card:hover i {
    transform: scale(1.15);
    color: #0b5ed7;
}

.btn-quick-access.quick-access-grid-card:hover span {
    color: #0d6efd;
}

/* ============================================================
   LINKS ÚTEIS E BANNER INSTITUCIONAL AQUARIUS (E3)
   ============================================================ */
.useful-links-card {
    border-radius: 0.625rem;
}

.useful-link-item {
    display: flex;
    align-items: center;
    padding: 0.55rem 0.65rem;
    border-radius: 0.5rem;
    text-decoration: none;
    background-color: #f8fafc;
    border: 1px solid #f1f5f9;
    transition: all 0.15s ease-in-out;
}

.useful-link-item:hover:not(.useful-link-disabled) {
    background-color: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transform: translateX(2px);
}

.useful-link-disabled {
    cursor: default;
    user-select: none;
}

.useful-link-icon-wrap {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-size: 0.95rem;
    margin-right: 0.65rem;
    flex-shrink: 0;
}

.aquarius-banner-card {
    background: radial-gradient(circle at center, #0e3568 0%, #07172f 85%, #051021 100%);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 0.75rem;
    box-shadow: 0 6px 20px rgba(7, 23, 47, 0.35);
}

.aquarius-banner-img-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
}

.aquarius-banner-img {
    max-width: 160px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.45));
    transition: transform 0.3s ease;
}

.aquarius-banner-card:hover .aquarius-banner-img {
    transform: scale(1.04);
}

.aquarius-banner-caption {
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    opacity: 0.9;
}

/* ============================================================
   REFINAMENTO DE PROPORÇÕES DO DASHBOARD (E4)
   Sidebar: 190px | Coluna Direita: 300px | Centro Fluido
   ============================================================ */
@media (min-width: 1200px) {
    .dashboard-main-row {
        display: flex;
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    .dashboard-main-col {
        flex: 1 1 auto;
        min-width: 0;
        width: calc(100% - 300px);
    }

    .dashboard-right-col {
        flex: 0 0 300px;
        width: 300px;
        max-width: 300px;
    }
}

@media (max-width: 1199.98px) {
    .dashboard-main-col {
        width: 100%;
    }

    .dashboard-right-col {
        width: 100%;
    }
}

/* ============================================================
   CARDS E TABELAS GERAIS
   ============================================================ */
.card {
    border: 1px solid var(--card-border);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    background-color: #ffffff;
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 600;
    padding: 0.9rem 1.25rem;
}

.card .bg-light {
    background-color: #f8fafc !important;
    border: 1px solid #eef2f6;
    border-radius: 0.5rem !important;
}

.alert {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.list-group-item {
    border-color: #f1f5f9;
}

.table th {
    font-weight: 600;
    font-size: 0.825rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: #64748b;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

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

.table-responsive {
    border-radius: 0.5rem;
}

.btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

.form-control:focus, .form-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.18);
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge-solicitada { background-color: #ffc107; color: #000; }
.badge-aprovada { background-color: #198754; }
.badge-separada { background-color: #0dcaf0; color: #000; }
.badge-distribuida { background-color: #0d6efd; }
.badge-recebida { background-color: #198754; }
.badge-recusada { background-color: #dc3545; }
.badge-rejeitada { background-color: #dc3545; }
.badge-cancelada { background-color: #6c757d; }

/* Status de lote */
.badge-ativo { background-color: #198754; }
.badge-consumido { background-color: #6c757d; }
.badge-vencido { background-color: #dc3545; }
.badge-perdido { background-color: #dc3545; }

/* Status de fornecedor */
.badge-inativo { background-color: #6c757d; }
.badge-suspenso { background-color: #ffc107; color: #000; }
