html, body {
    font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
}

:root {
    --mud-appbar-height: 72px;
}

/* Force AppBar toolbar to always use the full height (override MudBlazor responsive reductions) */
.mud-appbar .mud-toolbar-appbar {
    height: var(--mud-appbar-height) !important;
    min-height: var(--mud-appbar-height) !important;
}

/* Force clipped drawer to align with the fixed AppBar height at all breakpoints */
.mud-drawer--clipped-always {
    top: var(--mud-appbar-height) !important;
    height: calc(100% - var(--mud-appbar-height)) !important;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2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        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* ==================== ZAQ MART LANDING — MudBlazor-native ==================== */

/* Gradient text utility */
.zaq-gradient-text {
    background: linear-gradient(135deg, #00D9C0 0%, #7C3AED 50%, #EC4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ——— Hero section ——————————————————————————————————— */
.landing-hero {
    padding: 72px 0 64px;
}

/* ——— Stats bar ——————————————————————————————————————— */
.landing-stats-wrap {
    position: relative;
    z-index: 2;
    margin-top: -32px;
    margin-bottom: 24px;
}

.landing-stats-bar {
    border-radius: 16px;
    padding: 8px 0;
}

/* ——— Utility spacing ————————————————————————————————— */
.py-12 { padding-top: 80px; padding-bottom: 80px; }
.mb-8  { margin-bottom: 48px; }

/* ——— Responsive —————————————————————————————————————— */
@media (max-width: 960px) {
    .landing-hero { padding: 48px 0 40px; }
    .landing-stats-wrap { margin-top: -20px; }
    .py-12 { padding-top: 48px; padding-bottom: 48px; }
}

@media (max-width: 600px) {
    .landing-hero { padding: 32px 0 24px; }
    .py-12 { padding-top: 36px; padding-bottom: 36px; }
}

/* ==================== ROLE SELECTOR ==================== */
.role-selector .mud-input {
    color: white !important;
    font-size: 0.85rem;
    font-weight: 500;
}
.role-selector .mud-input-adornment svg {
    fill: white !important;
}
.role-selector .mud-input-outlined-border {
    border-color: rgba(255,255,255,.35) !important;
}
.role-selector:hover .mud-input-outlined-border {
    border-color: rgba(255,255,255,.65) !important;
}

/* ==================== ROLE DASHBOARD WIDGETS ==================== */
.role-dashboard-header {
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, rgba(0,217,192,.08) 0%, rgba(124,58,237,.08) 100%);
    border: 1px solid rgba(0,217,192,.15);
}

.stat-card {
    border-radius: 14px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12) !important;
}

.quick-action-btn {
    text-transform: none !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    justify-content: flex-start !important;
    padding: 12px 20px !important;
}

.section-title {
    font-weight: 700;
    letter-spacing: -.01em;
}

/* ==================== BARCODE SCANNER ==================== */
.barcode-scanner-container {
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--mud-palette-primary);
    background: #000;
    min-height: 200px;
}
.barcode-scanner-container video {
    border-radius: 10px;
}
.barcode-decoded-panel {
    border-radius: 12px;
    border: 1px solid rgba(0,217,192,.25);
    background: linear-gradient(135deg, rgba(0,217,192,.06) 0%, rgba(124,58,237,.06) 100%);
    padding: 16px;
}
.barcode-segment {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: 0.08em;
}

/* ==================== SHOP / CART ==================== */
.mud-card {
    transition: transform .15s ease, box-shadow .15s ease;
}
.mud-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.15) !important;
}

/* ==================== ORDER CARDS ==================== */
.order-expansion .mud-expand-panel {
    box-shadow: none !important;
}
.order-expansion .mud-expand-panel::before {
    display: none;
}
.order-expansion .mud-expand-panel-header {
    padding: 8px 16px;
    min-height: auto;
    border-top: 1px solid var(--mud-palette-lines-default);
}

/* ==================== PWA / OFFLINE ==================== */

/* Blazor WASM loading screen override */
#app .loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem;
}

/* Offline banner animation */
@keyframes offlinePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.offline-pulse {
    animation: offlinePulse 2s ease-in-out infinite;
}

/* PWA install prompt */
.pwa-install-prompt {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
}

/* Offline indicator pulse */
@keyframes pulse-offline {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== GLOBAL RESPONSIVE POLISH ====================
   Applied to every page: keeps the AppBar, drawer, containers,
   cards and dialogs rendering cleanly on phone, tablet and desktop. */

/* Prevent horizontal scrolling caused by wide cards/tables on mobile. */
html, body {
    overflow-x: hidden;
}

/* Long single-word numbers like "R 2.4M+" or unbroken English words must not
   blow out the layout on a 360px screen. */
.zaq-gradient-text,
.mud-typography {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ───────── AppBar (mobile-first sizing) ───────── */
@media (max-width: 599.95px) {
    :root {
        --mud-appbar-height: 56px;
    }
    .zaq-appbar .mud-toolbar { padding-left: 4px !important; padding-right: 4px !important; }
    .zaq-appbar .mud-icon-button { padding: 6px !important; }
    .zaq-appbar-logo { height: 40px !important; }
}

/* ───────── Main content container ───────── */
.zaq-main-container {
    padding-left: 16px;
    padding-right: 16px;
}
@media (max-width: 599.95px) {
    .zaq-main-container {
        padding-left: 8px !important;
        padding-right: 8px !important;
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }
}

/* ───────── Drawer: temporary on mobile must overlay full-height under AppBar ───────── */
@media (max-width: 959.95px) {
    .mud-drawer.mud-drawer-temporary {
        width: min(280px, 85vw) !important;
    }
}

/* ───────── Hero typography scales down on phones ───────── */
.zaq-hero-title {
    font-size: clamp(1.75rem, 6vw, 3rem) !important;
    line-height: 1.15 !important;
    word-break: break-word;
}

/* ───────── Quick Overview (Home page) — wraps cleanly ───────── */
.zaq-quick-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}
.zaq-quick-overview-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
    text-align: center;
    padding: 4px;
}
.zaq-quick-overview-cell .mud-typography {
    word-break: break-word;
    line-height: 1.2;
}
@media (max-width: 380px) {
    .zaq-quick-overview .pa-6 { padding: 16px !important; }
    .zaq-quick-overview-grid { gap: 4px; }
}

/* ───────── MudCard / MudPaper never overflow their parent ───────── */
.mud-card, .mud-paper {
    max-width: 100%;
}

/* MudGrid items with text content shouldn't blow out the grid track. */
.mud-grid-item { min-width: 0; }

/* ───────── Dialogs: full-width on phone, generous padding everywhere ───────── */
@media (max-width: 599.95px) {
    .mud-dialog-container .mud-dialog {
        margin: 8px !important;
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
    }
    .mud-dialog-content { padding: 16px !important; }
}

/* ───────── Tables & data grids scroll horizontally on small screens ───────── */
.mud-table-container,
.mud-data-grid {
    overflow-x: auto;
}

/* ───────── MudTabs slide horizontally instead of stacking awkwardly ───────── */
@media (max-width: 599.95px) {
    .mud-tabs-toolbar { overflow-x: auto; }
}

/* ───────── Stats grid cells (Home landing) — keep large numbers contained ───────── */
.landing-stats-bar .mud-typography-h4 {
    font-size: clamp(1.25rem, 4vw, 2.125rem);
}

/* ───────── Form inputs full-width on phones ───────── */
@media (max-width: 599.95px) {
    .mud-input-control,
    .mud-select { width: 100%; }
}

/* ───────── Buttons: prevent text overflow next to icons on phones ───────── */
.mud-button { max-width: 100%; }
.mud-button .mud-button-label { white-space: normal; }
