/* =========================================================
   SISTEMA DE GESTÃO DE ESTOQUE ESCOLAR
   Identidade visual administrativa — Bootstrap 5+
   Fonte: Inter | Ícones: Font Awesome 7.3
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

:root {
    /* Cores da marca */
    --brand-50: #eff6ff;
    --brand-100: #dbeafe;
    --brand-200: #bfdbfe;
    --brand-500: #3b82f6;
    --brand-600: #2563eb;
    --brand-700: #1d4ed8;
    --brand-800: #1e40af;

    /* Superfícies e textos */
    --app-bg: #f5f7fb;
    --surface: #ffffff;
    --surface-subtle: #f8fafc;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Estados */
    --success: #15803d;
    --success-bg: #f0fdf4;
    --warning: #b45309;
    --warning-bg: #fffbeb;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --info: #0369a1;
    --info-bg: #f0f9ff;

    /* Dimensões e efeitos */
    --radius-sm: 5px;
    --radius: 8px;
    --radius-lg: 11px;
    --control-height: 36px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-card: 0 2px 8px rgba(15, 23, 42, .045);
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, .13);

    /* Integração com Bootstrap */
    --bs-font-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bs-body-color: var(--text);
    --bs-body-bg: var(--app-bg);
    --bs-primary: var(--brand-600);
    --bs-primary-rgb: 37, 99, 235;
    --bs-border-color: var(--border);
    --bs-border-radius: var(--radius);
    --bs-border-radius-sm: var(--radius-sm);
    --bs-border-radius-lg: var(--radius-lg);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    margin: 0;
    background: var(--app-bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
    font: inherit;
}

a {
    color: var(--brand-600);
    text-decoration: none;
}

a:hover {
    color: var(--brand-700);
}

:focus-visible {
    outline: 0;
    box-shadow: var(--focus-ring);
}

::selection {
    color: #fff;
    background: var(--brand-600);
}

/* Tipografia */
h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    font-weight: 600;
    letter-spacing: -.025em;
    line-height: 1.3;
}

h1 { font-size: 1.65rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
h5 { font-size: .95rem; }
h6 { font-size: .875rem; }

p { color: inherit; }
small, .small { font-size: .8rem; }
.text-muted { color: var(--text-secondary) !important; }

/* Estrutura geral */
.app-wrapper {
    min-height: 100vh;
}

.app-content,
.main-content {
    min-width: 0;
    padding: 22px 24px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.page-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 650;
    letter-spacing: -.035em;
}

.page-subtitle {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: .875rem;
}

.section-title {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 600;
}

/* Cards e painéis */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.card-header {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: .92rem;
    font-weight: 600;
}

.card-body {
    padding: 16px;
}

.card-footer {
    padding: 11px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-subtle);
}

.panel {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

/* Botões: compactos e discretos */
.btn {
    min-height: 32px;
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    font-weight: 550;
    line-height: 1.35;
    box-shadow: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.btn:focus,
.btn:focus-visible {
    box-shadow: var(--focus-ring);
}

.btn-sm {
    min-height: 28px;
    padding: 4px 8px;
    font-size: .76rem;
}

.btn-lg {
    min-height: 38px;
    padding: 8px 14px;
    font-size: .9rem;
}

.btn-primary {
    border-color: var(--brand-600);
    background: var(--brand-600);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:active {
    border-color: var(--brand-700);
    background: var(--brand-700);
    color: #fff;
}

.btn-secondary {
    border-color: var(--border-strong);
    background: #fff;
    color: var(--text);
}

.btn-secondary:hover {
    border-color: #94a3b8;
    background: var(--surface-hover);
    color: var(--text);
}

.btn-outline-primary {
    border-color: var(--brand-200);
    color: var(--brand-700);
}

.btn-outline-primary:hover {
    border-color: var(--brand-600);
    background: var(--brand-50);
    color: var(--brand-700);
}

.btn-success { background: #15803d; border-color: #15803d; }
.btn-danger { background: #b91c1c; border-color: #b91c1c; }
.btn-warning { color: #422006; }
.btn-light {
    border-color: var(--border);
    background: var(--surface-subtle);
    color: var(--text);
}

.btn-link {
    min-height: auto;
    padding: 2px 4px;
    text-decoration: none;
    box-shadow: none;
}

.btn i,
.btn .fa,
.btn .fas,
.btn .far,
.btn .fab {
    margin-right: 4px;
}

/* Formulários */
.form-label,
label {
    margin-bottom: 5px;
    color: #475569;
    font-size: .8rem;
    font-weight: 550;
}

.form-control,
.form-select,
.input-group-text {
    min-height: var(--control-height);
    border-color: var(--border-strong);
    border-radius: var(--radius-sm);
    background-color: #fff;
    color: var(--text);
    font-size: .84rem;
    box-shadow: none;
}

.form-control,
.form-select {
    padding: 7px 10px;
}

.form-control::placeholder {
    color: #a0aaba;
    opacity: 1;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-500);
    background-color: #fff;
    color: var(--text);
    box-shadow: var(--focus-ring);
}

.form-control:disabled,
.form-select:disabled {
    background: #f1f5f9;
    color: var(--text-muted);
    cursor: not-allowed;
}

textarea.form-control {
    min-height: 82px;
    resize: vertical;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 7px 10px;
    background: var(--surface-subtle);
    color: var(--text-secondary);
}

.form-check-input {
    width: 15px;
    height: 15px;
    margin-top: .2em;
    border-color: var(--border-strong);
    cursor: pointer;
}

.form-check-input:checked {
    border-color: var(--brand-600);
    background-color: var(--brand-600);
}

.form-check-label {
    cursor: pointer;
}

.form-text,
.invalid-feedback,
.valid-feedback {
    font-size: .75rem;
}

.form-text { color: var(--text-secondary); }

/* Tabelas */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

.table {
    width: 100%;
    margin-bottom: 0;
    color: var(--text);
    font-size: .82rem;
    vertical-align: middle;
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
}

.table thead th {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-strong);
    background: #f8fafc;
    color: #64748b;
    font-size: .72rem;
    font-weight: 650;
    letter-spacing: .035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #edf1f5;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover > * {
    --bs-table-bg: #f8fafc;
    color: var(--text);
}

.table > :not(caption) > * > * {
    box-shadow: none;
}

.table .btn {
    margin: 1px;
}

.table th,
.table td {
    white-space: normal;
}

.table .text-nowrap,
.table td.actions,
.table th.actions {
    white-space: nowrap;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg: #fbfcfe;
}

/* Badges e indicadores */
.badge {
    padding: 4px 7px;
    border-radius: 5px;
    font-size: .69rem;
    font-weight: 600;
    letter-spacing: .01em;
}

.badge-soft-primary { background: var(--brand-50); color: var(--brand-700); }
.badge-soft-success { background: var(--success-bg); color: var(--success); }
.badge-soft-warning { background: var(--warning-bg); color: var(--warning); }
.badge-soft-danger { background: var(--danger-bg); color: var(--danger); }
.badge-soft-info { background: var(--info-bg); color: var(--info); }
.badge-soft-secondary { background: #f1f5f9; color: #475569; }

/* Alertas */
.alert {
    padding: 10px 13px;
    border-width: 1px;
    border-radius: var(--radius);
    font-size: .83rem;
}

.alert i { margin-right: 5px; }

/* Navegação e menu lateral */
.navbar {
    min-height: 56px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.navbar-brand {
    color: var(--text);
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: -.02em;
}

.nav-link {
    color: var(--text-secondary);
    font-size: .84rem;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    color: var(--brand-700);
}

.sidebar {
    width: 238px;
    min-height: 100vh;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 9px;
    padding: 9px 11px;
    border-radius: 6px;
}

.sidebar .nav-link i {
    width: 17px;
    color: #94a3b8;
    text-align: center;
}

.sidebar .nav-link:hover {
    background: var(--surface-subtle);
}

.sidebar .nav-link.active {
    background: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
}

.sidebar .nav-link.active i {
    color: var(--brand-600);
}

/* Paginação */
.pagination {
    gap: 3px;
}

.page-link {
    min-width: 30px;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm) !important;
    color: var(--text-secondary);
    font-size: .78rem;
}

.page-item.active .page-link {
    border-color: var(--brand-600);
    background: var(--brand-600);
}

/* Modais e dropdowns */
.modal-content {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 35px rgba(15, 23, 42, .16);
}

.modal-header,
.modal-footer {
    padding: 13px 16px;
    border-color: var(--border);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.modal-body { padding: 16px; }

.dropdown-menu {
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .10);
    font-size: .83rem;
}

.dropdown-item {
    padding: 7px 10px;
    border-radius: 5px;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--surface-hover);
}

/* Elementos auxiliares */
hr {
    border-color: var(--border);
    opacity: 1;
}

hr.subtle { opacity: .65; }

.stat-card {
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: .78rem;
    font-weight: 500;
}

.stat-card .stat-value {
    margin-top: 5px;
    color: var(--text);
    font-size: 1.55rem;
    font-weight: 650;
    letter-spacing: -.04em;
}

.stat-card .stat-icon {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--brand-50);
    color: var(--brand-600);
}

.empty-state {
    padding: 30px 16px;
    color: var(--text-secondary);
    text-align: center;
}

.empty-state i {
    display: block;
    margin-bottom: 9px;
    color: var(--text-muted);
    font-size: 1.7rem;
}

/* Barra de rolagem discreta */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #cbd5e1;
}
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Responsividade */
@media (max-width: 991.98px) {
    .app-content,
    .main-content {
        padding: 18px;
    }

    .sidebar {
        width: 220px;
    }
}

@media (max-width: 767.98px) {
    html { font-size: 13px; }

    .app-content,
    .main-content {
        padding: 14px 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 15px;
    }

    .page-header .page-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .page-title { font-size: 1.3rem; }

    .card-body { padding: 13px; }

    .card-header { padding: 11px 13px; }

    /* Tabelas mantêm colunas e rolam horizontalmente em telas pequenas. */
    .table {
        min-width: 620px;
        font-size: .79rem;
    }

    .table thead th,
    .table tbody td {
        padding: 9px 10px;
    }

    .btn {
        min-height: 32px;
    }

    .modal-dialog {
        margin: 10px;
    }

    .modal-dialog-centered {
        min-height: calc(100% - 20px);
    }

    .stat-card { padding: 12px; }
}

@media (max-width: 575.98px) {
    .app-content,
    .main-content {
        padding: 12px 10px;
    }

    .row.g-3 {
        --bs-gutter-x: .65rem;
        --bs-gutter-y: .65rem;
    }

    .form-control,
    .form-select {
        font-size: 16px; /* evita zoom automático em navegadores móveis */
    }

    .page-actions .btn {
        flex: 0 0 auto;
    }

    .modal-dialog {
        margin: 7px;
    }

    .modal-body { padding: 13px; }
}

/* Acessibilidade: respeita preferência por menos animação */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* =========================================================
   AJUSTES PARA MONITORES GRANDES
   ========================================================= */

@media (min-width: 1400px) {

    .app-content,
    .main-content {
        padding: 26px 30px;
    }

}
