/*
 * CostMint global styles.
 *
 * The theme itself lives in Theme/CostMintTheme.cs; this file covers only what MudBlazor's
 * theming cannot reach - the pre-Blazor splash, the error bar, scrollbars, and a few layout
 * refinements that keep surfaces reading as bordered cards rather than floating shadows.
 */

html, body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent the iOS zoom-on-focus that fires for inputs under 16px. */
@supports (-webkit-touch-callout: none) {
    input, select, textarea {
        font-size: 16px;
    }
}

/* ---- Splash shown before the WASM runtime boots ---- */

.costmint-splash {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #f8fafc;
    color: #0f172a;
}

.costmint-splash__mark {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.costmint-splash__name {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.costmint-splash__bar {
    width: 132px;
    height: 3px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.costmint-splash__bar span {
    display: block;
    width: 40%;
    height: 100%;
    border-radius: 999px;
    background: #10b981;
    animation: costmint-slide 1.1s ease-in-out infinite;
}

@keyframes costmint-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

@media (prefers-color-scheme: dark) {
    .costmint-splash { background: #0b1220; color: #f1f5f9; }
    .costmint-splash__bar { background: #1e293b; }
}

/* ---- Surfaces ---- */

/* Borders and a whisper of shadow, rather than heavy elevation. */
.costmint-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.costmint-card--interactive:hover {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
}

/* Right-align money and quantities so decimal points line up down a column. */
.costmint-numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Large dashboard figures read better with even digit widths. */
.costmint-metric {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* The recipe total stays in view while the ingredient list scrolls. */
.costmint-sticky-summary {
    position: sticky;
    top: 88px;
}

@media (max-width: 960px) {
    .costmint-sticky-summary {
        position: static;
    }
}

/* ---- Scrollbars ---- */

* {
    scrollbar-width: thin;
    scrollbar-color: var(--mud-palette-lines-inputs) transparent;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }

*::-webkit-scrollbar-thumb {
    background-color: var(--mud-palette-lines-inputs);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover { background-color: var(--mud-palette-text-secondary); }

/* ---- Blazor's unhandled-error bar ---- */

#blazor-error-ui {
    background: #fef3c7;
    color: #78350f;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
    font-size: 14px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ---- Print ---- */

@media print {
    .mud-appbar, .mud-drawer, .costmint-no-print { display: none !important; }
    .mud-main-content { padding: 0 !important; margin: 0 !important; }
    .costmint-card { box-shadow: none; border-color: #cbd5e1; break-inside: avoid; }
}
