/* ── Layout ─────────────────────────────────────────────── */
body {
    font-size: 0.9rem;
}

main {
    min-height: calc(100vh - 200px);
}

/* ── Navigation ─────────────────────────────────────────── */
/* On narrow screens the tab bar has more items than fit — it scrolls
   horizontally (base.html: flex-nowrap overflow-x-auto) instead of
   wrapping into several cramped rows. This just hides the scrollbar so it
   reads as a swipeable strip rather than a literal scroll widget. */
.nav-tabs {
    -ms-overflow-style: none;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tabs .nav-link {
    white-space: nowrap;
    color: #555;
    border-bottom: 3px solid transparent;
    border-top: none;
    border-left: none;
    border-right: none;
    padding: 0.6rem 1rem;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-tabs .nav-link:hover {
    color: #0d6efd;
    border-bottom-color: #b8d0ff;
}

.nav-tabs .nav-link.active {
    color: #0d6efd;
    border-bottom: 3px solid #0d6efd;
    background: transparent;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
    border-radius: 0.5rem;
}

/* ── Tables ─────────────────────────────────────────────── */
.table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
}

.table td {
    vertical-align: middle;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge-margin-high {
    background-color: #d1e7dd;
    color: #0f5132;
}

.badge-margin-mid {
    background-color: #fff3cd;
    color: #664d03;
}

.badge-margin-low {
    background-color: #f8d7da;
    color: #842029;
}

/* ── Modals ─────────────────────────────────────────────── */
.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* ── Recipe Builder ─────────────────────────────────────── */
.recipe-row {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
}

.recipe-cost-summary {
    background-color: #e9f3ff;
    border-left: 4px solid #0d6efd;
    border-radius: 0.375rem;
    padding: 1rem 1.25rem;
}

/* ── Tom Select overrides ───────────────────────────────── */
.ts-wrapper {
    min-width: 0;
}

.ts-control {
    font-size: 0.875rem;
}

/* ── Mobile ─────────────────────────────────────────────── */
/* The "title + action buttons" header row (every list page: Ingredientes,
   Productos, Proveedores, Personal, Usuarios, Reportes) uses full-size
   buttons that look oversized on a phone screen. Shrink them there only —
   desktop/tablet keep the normal size. Targets the header row by its exact
   class combo rather than editing every template. */
@media (max-width: 575.98px) {
    .d-flex.justify-content-between.align-items-center.mb-3 .btn {
        padding: 0.25rem 0.6rem;
        font-size: 0.8rem;
    }
}

/* ── Utility ─────────────────────────────────────────────── */
.cursor-pointer {
    cursor: pointer;
}

.text-currency::before {
    content: '$';
}

/* ── Dark mode overrides ────────────────────────────────── */
/* Bootstrap's bg-white/bg-light/table-light/alert-light utilities are fixed
   colors, not theme-aware, so they need explicit dark-mode overrides. */
[data-bs-theme="dark"] body.bg-light {
    background-color: var(--bs-body-bg) !important;
}

[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-light {
    background-color: var(--bs-tertiary-bg) !important;
}

[data-bs-theme="dark"] .table-light {
    --bs-table-bg: var(--bs-tertiary-bg);
    --bs-table-color: var(--bs-body-color);
}

[data-bs-theme="dark"] .table th {
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .alert-light {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .badge.bg-light {
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .btn-link.text-dark {
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .nav-tabs .nav-link:hover {
    color: #6ea8fe;
    border-bottom-color: rgba(110, 168, 254, 0.4);
}

[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    color: #6ea8fe;
    border-bottom-color: #6ea8fe;
}

[data-bs-theme="dark"] .recipe-row {
    background-color: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .recipe-cost-summary {
    background-color: rgba(13, 110, 253, 0.15);
}

[data-bs-theme="dark"] .modal-header {
    background-color: var(--bs-tertiary-bg);
    border-bottom-color: var(--bs-border-color);
}
