/* ── Design Tokens ── */
:root {
    /* Layout */
    --mmca-sidebar-bg: #1A2035;
    --mmca-sidebar-bg-dark: #141B2D;
    --mmca-sidebar-width: 220px;
    --mmca-divider: #E0E0E0;
    --mmca-content-max-width: 700px;
    --mmca-content-max-width-wide: 1200px;

    /* Brand colors */
    --mmca-primary: #1565C0;
    --mmca-primary-dark: #0D47A1;

    /* Spacing scale */
    --mmca-space-xs: 0.25rem;
    --mmca-space-sm: 0.5rem;
    --mmca-space-md: 1rem;
    --mmca-space-lg: 1.5rem;
    --mmca-space-xl: 2rem;
    --mmca-space-2xl: 3rem;
    --mmca-space-3xl: 5rem;

    /* Responsive typography */
    --mmca-text-hero: clamp(1.5rem, 4vw, 2.4rem);
    --mmca-text-section-title: clamp(1.25rem, 3vw, 1.75rem);
    --mmca-text-section-subtitle: clamp(0.875rem, 1.5vw, 1rem);

    /* Z-index scale */
    --mmca-z-nav-backdrop: 100;
    --mmca-z-nav-menu: 200;
    --mmca-z-hamburger: 300;
    --mmca-z-mobile-appbar: 400;
    --mmca-z-error-ui: 1000;
    --mmca-z-drawer: 1300;
    --mmca-z-skip-nav: 9999;
    --mmca-z-snackbar-mobile: 10000;
}

html, body {
    font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    height: auto;
    overflow-y: auto;
}

a, .btn-link {
    color: #1565C0;
}

.btn-primary {
    color: #fff;
    background-color: #1565C0;
    border-color: #0D47A1;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.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,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodH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AxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

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

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ── Snackbar: prevent clipping on narrow viewports ── */
.mud-snackbar {
    max-width: calc(100vw - 2rem);
}

/* ── Snackbar: ensure visibility on mobile ── */
@media (max-width: 1023.98px) {
    .mud-snackbar {
        min-width: 0;
    }
}

/* ── Snackbar: always above the cart drawer on mobile ── */
/* MudDrawer (temporary) sits at z-index ~1300, its overlay at ~1299.
   On mobile the cart drawer goes full-width and obscures the snackbar
   container. Bump the snackbar z-index so it floats above the drawer. */
@media (max-width: 1023.98px) {
    .mud-snackbar-location-top-center {
        z-index: var(--mmca-z-snackbar-mobile, 10000) !important;
    }
}

/* ── CartDrawer: responsive width tiers ──
   Override the CSS variable so MudBlazor calculates both the open width
   AND the closed-state offset (right: calc(-1 * var(--mud-drawer-width)))
   from the same value. Overriding `width` directly would desync these. */
@media (max-width: 599px) {
    .cart-drawer {
        --mud-drawer-width: 100vw !important;
    }
}

@media (min-width: 1920px) {
    .cart-drawer {
        --mud-drawer-width: 440px !important;
    }
}

/* Larger touch targets for cart buttons on mobile (48px minimum per Material Design) */
@media (max-width: 1023.98px) {
    .cart-drawer .mud-icon-button {
        min-width: 48px !important;
        min-height: 48px !important;
    }
}

/* ── Visually hidden (accessibility) ── */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Auth pages: responsive top margin ── */
.auth-container {
    margin-top: 2rem;
}

@media (min-width: 1024px) {
    .auth-container {
        margin-top: 4rem;
    }
}

/* ── Detail tables: responsive label columns ── */
.detail-label-col {
    min-width: 100px;
    width: 35%;
    max-width: 200px;
}

/* ── Page header layout ── */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* ── Detail card standard ── */
.detail-card {
    max-width: var(--mmca-content-max-width, 700px);
}

/* ── Mobile: responsive data grids ── */
@media (max-width: 1023.98px) {
    /* Hide non-essential data-grid columns on mobile */
    .hide-below-desktop {
        display: none !important;
    }

    /* Hide inline column filters on mobile (search field provides filtering) */
    .mud-table thead tr:not(:first-child) {
        display: none !important;
    }

    /* Allow horizontal swipe and prevent vertical scroll trapping */
    .mud-table-container {
        overflow-x: auto !important;
        overflow-y: visible !important;
    }

    /* Let pager controls wrap on narrow screens */
    .mud-table-pagination-toolbar {
        flex-wrap: wrap;
        padding: 0.5rem !important;
        gap: 0.25rem;
    }

    /* Mobile card list items */
    .mobile-list-card {
        cursor: pointer;
    }

    .mobile-list-card .mud-card-content .mud-icon-button {
        min-width: 48px;
        min-height: 48px;
    }
}

/* ── Infinite scroll sentinel & loading indicator ── */
.infinite-scroll-sentinel {
    min-height: 1px;
}

.infinite-scroll-loading {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

/* ══════════════════════════════════════════
   Shared Home Page Patterns
   ══════════════════════════════════════════ */

/* ── Entrance animation ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Full-bleed: break out of parent article padding ──
   Mobile: article padding is 0.5rem each side (MainLayout).
   Desktop: article padding is 2rem left / 1.5rem right.
   Top: compensates for .content padding-top: 1.1rem. */
.mmca-full-bleed {
    overflow-x: hidden;
    margin: -1.1rem -1rem 0;
}

@media (min-width: 1024px) {
    .mmca-full-bleed {
        margin: -1.1rem -1.5rem 0 -2rem;
    }
}

/* ── Section heading ── */
.mmca-section-heading {
    text-align: center;
    position: relative;
    margin-bottom: var(--mmca-space-xl, 2.5rem);
    padding-top: var(--mmca-space-md, 1rem);
}

.mmca-section-heading .mud-icon {
    font-size: 8rem !important;
    color: rgba(0, 0, 0, 0.04);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.mmca-section-heading-light .mud-icon {
    color: rgba(255, 255, 255, 0.06);
}

.mmca-section-heading .mud-typography {
    position: relative;
    font-weight: 700;
    z-index: 1;
}

.mmca-section-heading-light .mud-typography {
    color: #fff;
}

.mmca-section-title-underline {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--mmca-primary, #1565C0), var(--mmca-accent, #42A5F5));
    margin: 0.75rem auto 0;
    border-radius: 2px;
}

.mmca-section-description {
    max-width: 700px;
    margin: 0 auto;
    color: rgba(0, 0, 0, 0.62);
    line-height: 1.8;
}

/* ── Angled section dividers ── */
.mmca-section-angle {
    position: relative;
}

.mmca-section-angle-top::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 0;
    right: 0;
    height: 30px;
    background: inherit;
    clip-path: polygon(0 100%, 100% 0, 100% 100%);
}
