/* =====================================================================
   RESTAURANT SYSTEM — GLOBAL FOUNDATION ONLY
   ---------------------------------------------------------------------
   This file intentionally contains NO module-specific presentation.
   Sidebar, dashboard, POS, reports, store, auth, public website, etc.
   must own their CSS inside public/assets/css/modules/.
   ===================================================================== */

:root {
    /* Brand */
    --brand-navy: #0B2E69;
    --brand-blue-deep: #113A8D;
    --brand-blue: #0F78D1;
    --brand-blue-soft: #EFF6FE;
    --brand-gold: #F4BC1C;
    --brand-gold-deep: #D89D00;
    --brand-gold-soft: #FFF8E1;

    /* System surfaces */
    --system-bg: #F6F8FC;
    --system-surface: #FFFFFF;
    --system-surface-soft: #F9FBFE;
    --system-text: #183452;
    --system-muted: #6F8098;
    --system-border: #E2E9F2;

    /* Semantic colours — status only */
    --system-success: #168447;
    --system-warning: #D89D00;
    --system-danger: #D63B45;
    --system-info: #0F78D1;

    /* Shared geometry */
    --system-radius-sm: 9px;
    --system-radius: 12px;
    --system-radius-lg: 18px;
    --system-shadow-sm: 0 8px 24px rgba(11, 46, 105, .055);
    --system-shadow-md: 0 18px 44px rgba(11, 46, 105, .10);

    /* Browser viewport helper. app.js may update this value. */
    --app-vh: 1vh;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
    background: var(--system-bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--system-text);
    background: var(--system-bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.restaurant-theme {
    color: var(--system-text);
    background: var(--system-bg);
}

img,
picture,
svg,
video,
canvas {
    max-width: 100%;
}

img {
    height: auto;
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: inherit;
    text-underline-offset: .14em;
}

a,
button,
.btn,
.form-control,
.form-select {
    transition:
        color .18s ease,
        background-color .18s ease,
        border-color .18s ease,
        box-shadow .18s ease,
        transform .18s ease;
}

::selection {
    color: #fff;
    background: var(--brand-blue);
}

:focus-visible {
    outline: 3px solid rgba(15, 120, 209, .30);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   SHARED BOOTSTRAP FOUNDATION
   Keep these rules neutral. Modules may extend/override them locally.
   --------------------------------------------------------------------- */

.card,
.modal-content,
.dropdown-menu {
    border-color: var(--system-border);
}

.card {
    border-radius: var(--system-radius-lg);
    background: var(--system-surface);
    box-shadow: var(--system-shadow-sm);
}

.modal-content {
    border-radius: var(--system-radius-lg);
    background: var(--system-surface);
    box-shadow: var(--system-shadow-md);
}

.dropdown-menu {
    padding: 7px;
    border-radius: var(--system-radius);
    background: var(--system-surface);
    box-shadow: var(--system-shadow-md);
}

.dropdown-item {
    border-radius: 8px;
}

.btn {
    border-radius: var(--system-radius-sm);
    font-weight: 700;
}

.btn-primary {
    color: #fff;
    border-color: var(--brand-blue);
    background: var(--brand-blue);
}

.btn-primary:hover,
.btn-primary:focus {
    color: #fff;
    border-color: var(--brand-blue-deep);
    background: var(--brand-blue-deep);
}

.btn-outline-primary {
    color: var(--brand-blue-deep);
    border-color: rgba(15, 120, 209, .48);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: #fff;
    border-color: var(--brand-blue);
    background: var(--brand-blue);
}

.btn-warning {
    color: var(--brand-navy);
    border-color: var(--brand-gold);
    background: var(--brand-gold);
}

.form-control,
.form-select,
.input-group-text {
    min-height: 42px;
    border-color: var(--system-border);
    border-radius: var(--system-radius-sm);
    color: var(--system-text);
    background-color: var(--system-surface);
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(15, 120, 209, .58);
    box-shadow: 0 0 0 .2rem rgba(15, 120, 209, .10);
}

.form-control[readonly],
.form-control:disabled,
.form-select:disabled {
    color: var(--system-muted);
    background: #F4F7FB;
}

.form-label {
    color: #465C76;
    font-weight: 700;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--system-text);
    --bs-table-border-color: #E9EEF5;
    color: var(--system-text);
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}

.table thead th {
    color: #536780;
    background: #F7F9FC;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.badge {
    border-radius: 999px;
    font-weight: 800;
}

.pagination {
    gap: 4px;
}

.pagination .page-link {
    min-width: 36px;
    min-height: 36px;
    display: inline-grid;
    place-items: center;
    border-color: var(--system-border);
    border-radius: 9px !important;
    color: var(--brand-blue-deep);
    background: #fff;
}

.pagination .page-item.active .page-link {
    color: #fff;
    border-color: var(--brand-blue);
    background: var(--brand-blue);
}

.text-muted {
    color: var(--system-muted) !important;
}

/* ---------------------------------------------------------------------
   SMALL SYSTEM UTILITIES
   --------------------------------------------------------------------- */

.min-w-0 {
    min-width: 0 !important;
}

.system-surface {
    background: var(--system-surface);
}

.system-surface-soft {
    background: var(--system-surface-soft);
}

.system-border {
    border-color: var(--system-border) !important;
}

/* ---------------------------------------------------------------------
   GLOBAL PAGE LOADER
   This is application infrastructure, not a page/module design.
   --------------------------------------------------------------------- */

.page-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    padding: 24px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    background: rgba(246, 248, 252, .96);
    transition: opacity .2s ease, visibility .2s ease;
}

.page-loader.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.page-loader-panel {
    width: min(360px, calc(100vw - 32px));
    display: grid;
    justify-items: center;
    gap: 13px;
    padding: 26px;
    text-align: center;
    border: 1px solid var(--system-border);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(11, 46, 105, .14);
}

.page-loader-core {
    position: relative;
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
}

.page-loader-logo-wrap {
    position: relative;
    z-index: 2;
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 10px 28px rgba(11, 46, 105, .15);
}

.page-loader-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.page-loader-ring {
    position: absolute;
    inset: 0;
    border: 3px solid rgba(15, 120, 209, .12);
    border-top-color: var(--brand-blue);
    border-radius: 50%;
    animation: systemLoaderSpin 1s linear infinite;
}

.page-loader-ring-secondary {
    inset: 7px;
    border-top-color: var(--brand-gold);
    animation-duration: 1.35s;
    animation-direction: reverse;
}

.page-loader-copy strong {
    display: block;
    color: var(--brand-navy);
    font-size: 1rem;
    font-weight: 850;
}

.page-loader-copy span {
    display: block;
    margin-top: 3px;
    color: var(--system-muted);
    font-size: .78rem;
}

.page-loader-progress {
    width: min(230px, 78%);
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: #EAF0F7;
}

.page-loader-progress > span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand-blue), var(--brand-gold));
    animation: systemLoaderProgress 1.1s ease-in-out infinite alternate;
}

@keyframes systemLoaderSpin {
    to { transform: rotate(360deg); }
}

@keyframes systemLoaderProgress {
    from { transform: translateX(-65%); }
    to { transform: translateX(145%); }
}

/* ---------------------------------------------------------------------
   ACCESSIBILITY / MOTION / PRINT FOUNDATION
   --------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

@media print {
    html,
    body {
        color: #111 !important;
        background: #fff !important;
    }

    .page-loader {
        display: none !important;
    }

    .card,
    .modal-content {
        box-shadow: none !important;
    }
}
