/* ── Brand tokens ───────────────────────────────── */
:root {
    --brand-red:      #D62828;
    --brand-red-dark: #8B1E1E;
    --brand-orange:   #F77F00;
    --brand-yellow:   #FCBF49;
    --brand-carbon:   #1A1A1A;
    --brand-cream:    #FFF3D6;
    --brand-teal:     #2A9D8F;
    --brand-blue:     #457B9D;

    --font-brand: 'Cinzel', serif;
    --font-ui:    'Poppins', sans-serif;
}

/* ── Global typography ──────────────────────────── */
body, .mud-typography {
    font-family: var(--font-ui) !important;
}

.brand-title {
    font-family: var(--font-brand) !important;
    letter-spacing: 0.04em;
}

/* ── Base resets ────────────────────────────────── */
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: var(--brand-red-dark);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.blazor-error-boundary::after { content: "Ocurrio un error." }

/* ── AppBar fire stripe ──────────────────────────── */
.mud-appbar {
    position: relative;
    overflow: hidden;
}
.mud-appbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--brand-red),
        var(--brand-orange),
        var(--brand-yellow),
        var(--brand-orange),
        var(--brand-red)
    );
    background-size: 200% 100%;
    animation: fireStripe 3s linear infinite;
}
@keyframes fireStripe {
    0%   { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* ── Drawer logo ────────────────────────────────── */
.drawer-logo {
    padding: 16px 16px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(247,127,0,0.3);
    margin-bottom: 8px;
}
.drawer-logo-icon {
    color: var(--brand-orange) !important;
    font-size: 2rem !important;
}

.drawer-brand-text {
    font-family: var(--font-brand) !important;
    font-weight: 700 !important;
    color: var(--brand-cream) !important;
    letter-spacing: 0.03em;
    font-size: 0.9rem !important;
}

/* ── Session loader spinner ─────────────────────── */
.session-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(247, 127, 0, 0.2);
    border-top-color: #F77F00;
    border-radius: 50%;
    animation: spinnerRotate 0.8s linear infinite;
}
@keyframes spinnerRotate {
    to { transform: rotate(360deg); }
}

/* ── Login logo glow ────────────────────────────── */
.logo-glow {
    animation: logoGlow 2.5s ease-in-out infinite alternate;
}
@keyframes logoGlow {
    from { filter: drop-shadow(0 0 6px rgba(214, 40, 40, 0.55)) drop-shadow(0 0 14px rgba(247, 127, 0, 0.35)); }
    to   { filter: drop-shadow(0 0 16px rgba(214, 40, 40, 0.9)) drop-shadow(0 0 32px rgba(247, 127, 0, 0.65)); }
}

/* ── Login page ─────────────────────────────────── */
body {
    background-color: var(--brand-carbon);
}

/* Login card wrapper */
.login-card-wrapper {
    width: 100%;
    animation: loginCardEnter 0.65s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1)) both;
}
@keyframes loginCardEnter {
    from { opacity: 0; transform: translateY(28px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Glassmorphism login card */
.login-card {
    background: rgba(38, 38, 38, 0.80) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(247, 127, 0, 0.30) !important;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6) !important;
}

/* ── Login background animation ─────────────────── */
.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: var(--brand-carbon);
}

/* Vignette: darkens edges, focuses eye on center card */
.login-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 70% 70% at 50% 50%,
        transparent 20%,
        rgba(10, 10, 10, 0.55) 100%
    );
    pointer-events: none;
}

/* ── Glowing orbs ────────────────────────────────── */
.login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    will-change: transform;
}

.orb-1 {
    width: 560px; height: 560px;
    background: radial-gradient(circle, rgba(214, 40, 40, 0.7) 0%, transparent 70%);
    top: -15%; left: -12%;
    animation: orbDrift1 26s ease-in-out infinite alternate;
}
.orb-2 {
    width: 480px; height: 480px;
    background: radial-gradient(circle, rgba(247, 127, 0, 0.65) 0%, transparent 70%);
    bottom: -18%; right: -10%;
    animation: orbDrift2 21s ease-in-out infinite alternate;
}
.orb-3 {
    width: 360px; height: 360px;
    background: radial-gradient(circle, rgba(252, 191, 73, 0.45) 0%, transparent 70%);
    top: 15%; left: 38%;
    animation: orbDrift3 18s ease-in-out infinite alternate;
}
.orb-4 {
    width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(139, 30, 30, 0.7) 0%, transparent 70%);
    bottom: 8%; left: 2%;
    animation: orbDrift4 23s ease-in-out infinite alternate;
}
.orb-5 {
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(247, 127, 0, 0.5) 0%, transparent 70%);
    top: 4%; right: 8%;
    animation: orbDrift5 15s ease-in-out infinite alternate;
}

@keyframes orbDrift1 {
    0%   { transform: translate(0px,   0px)   scale(1);    }
    33%  { transform: translate(70px,  55px)  scale(1.08); }
    66%  { transform: translate(30px,  110px) scale(0.95); }
    100% { transform: translate(100px, 30px)  scale(1.06); }
}
@keyframes orbDrift2 {
    0%   { transform: translate(0px,    0px)   scale(1);    }
    50%  { transform: translate(-80px, -65px)  scale(1.1);  }
    100% { transform: translate(-40px, -110px) scale(0.92); }
}
@keyframes orbDrift3 {
    0%   { transform: translate(0px,  0px)  scale(1);    }
    40%  { transform: translate(-55px, 45px) scale(1.18); }
    100% { transform: translate(65px, -35px) scale(0.88); }
}
@keyframes orbDrift4 {
    0%   { transform: translate(0px, 0px)    scale(1);    }
    50%  { transform: translate(45px, -55px) scale(1.12); }
    100% { transform: translate(15px, -95px) scale(0.93); }
}
@keyframes orbDrift5 {
    0%   { transform: translate(0px,   0px)  scale(1);    }
    100% { transform: translate(-75px, 55px) scale(1.28); }
}

/* ── Ember particles ─────────────────────────────── */
.ember {
    position: absolute;
    bottom: -6px;
    border-radius: 50%;
    will-change: transform, opacity;
    animation: emberRise linear infinite;
}

@keyframes emberRise {
    0%   { opacity: 0;   transform: translateY(0)      translateX(0);   }
    8%   { opacity: 1;                                                    }
    85%  { opacity: 0.4;                                                  }
    100% { opacity: 0;   transform: translateY(-108vh) translateX(22px); }
}

/* Individual ember positions, sizes, and timings */
.e-1  { width: 3px; height: 3px; left:  8%; animation-duration: 6.5s;  animation-delay: 0s;    background: #FCBF49; box-shadow: 0 0 4px 1px rgba(252,191,73,0.6); }
.e-2  { width: 2px; height: 2px; left: 18%; animation-duration: 9s;    animation-delay: 2s;    background: #F77F00; box-shadow: 0 0 3px 1px rgba(247,127,0,0.5);  }
.e-3  { width: 4px; height: 4px; left: 28%; animation-duration: 7s;    animation-delay: 4.5s;  background: #FCBF49; box-shadow: 0 0 5px 2px rgba(252,191,73,0.5); }
.e-4  { width: 2px; height: 2px; left: 38%; animation-duration: 8s;    animation-delay: 1s;    background: #F77F00; box-shadow: 0 0 3px 1px rgba(247,127,0,0.5);  }
.e-5  { width: 3px; height: 3px; left: 48%; animation-duration: 6s;    animation-delay: 3.5s;  background: #FCBF49; box-shadow: 0 0 4px 1px rgba(252,191,73,0.6); }
.e-6  { width: 2px; height: 2px; left: 57%; animation-duration: 10s;   animation-delay: 0.8s;  background: #D62828; box-shadow: 0 0 4px 1px rgba(214,40,40,0.5);  }
.e-7  { width: 3px; height: 3px; left: 66%; animation-duration: 7.5s;  animation-delay: 5s;    background: #F77F00; box-shadow: 0 0 4px 1px rgba(247,127,0,0.6);  }
.e-8  { width: 2px; height: 2px; left: 74%; animation-duration: 8.5s;  animation-delay: 2.5s;  background: #FCBF49; box-shadow: 0 0 3px 1px rgba(252,191,73,0.5); }
.e-9  { width: 4px; height: 4px; left: 82%; animation-duration: 6s;    animation-delay: 1.8s;  background: #F77F00; box-shadow: 0 0 5px 2px rgba(247,127,0,0.5);  }
.e-10 { width: 2px; height: 2px; left: 22%; animation-duration: 9.5s;  animation-delay: 6s;    background: #D62828; box-shadow: 0 0 3px 1px rgba(214,40,40,0.5);  }
.e-11 { width: 3px; height: 3px; left: 53%; animation-duration: 7s;    animation-delay: 3s;    background: #FCBF49; box-shadow: 0 0 4px 1px rgba(252,191,73,0.6); }
.e-12 { width: 2px; height: 2px; left: 90%; animation-duration: 8s;    animation-delay: 4s;    background: #F77F00; box-shadow: 0 0 3px 1px rgba(247,127,0,0.5);  }

/* ── Menu item cards ────────────────────────────── */
.menu-item-card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    border: 2px solid transparent;
    height: 100%;
    user-select: none;
}
.menu-item-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(214,40,40,0.25) !important;
    border-color: var(--brand-red);
}
.menu-item-card:active {
    transform: scale(0.97);
}
.menu-item-emoji {
    font-size: 2.4rem;
    line-height: 1;
    display: block;
    margin-bottom: 4px;
}

/* ── Cart ───────────────────────────────────────── */
.cart-item-enter {
    animation: slideInRight 0.2s ease;
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Kitchen timer urgency ──────────────────────── */
.kitchen-card {
    border-left: 5px solid transparent;
    transition: border-color 0.5s ease;
}
.kitchen-card.urgent-low   { border-left-color: #4CAF50; }
.kitchen-card.urgent-med   { border-left-color: var(--brand-orange); }
.kitchen-card.urgent-high  { border-left-color: var(--brand-red); }
.kitchen-card.urgent-over  {
    border-left-color: var(--brand-red);
    animation: pulse-red 1.2s ease-in-out infinite;
}
@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(214,40,40,0.4); }
    50%       { box-shadow: 0 0 0 8px rgba(214,40,40,0); }
}

.timer-badge {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 52px;
    text-align: center;
    font-family: var(--font-ui);
}
.timer-low  { background: rgba(76,175,80,0.15);  color: #2e7d32; }
.timer-med  { background: rgba(247,127,0,0.15);  color: #c66200; }
.timer-high { background: rgba(214,40,40,0.15);  color: var(--brand-red); }
.timer-over { background: var(--brand-red); color: #fff; }

.new-order-badge {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Status chips (dark-mode safe) ──────────────── */
.status-pending    { background: rgba(252,191,73,0.2)  !important; color: #FCBF49 !important; }
.status-inprogress { background: rgba(247,127,0,0.2)   !important; color: #F77F00 !important; }
.status-completed  { background: rgba(42,157,143,0.2)  !important; color: #2A9D8F !important; }

/* ── Module accent helpers ──────────────────────── */
.accent-waiter   { color: var(--brand-red); }
.accent-kitchen  { color: var(--brand-orange); }
.accent-checkout { color: var(--brand-yellow); }
.accent-inventory { color: var(--brand-blue); }

/* ── Page fade-in ───────────────────────────────── */
.mud-main-content > .pa-4 {
    animation: fadeIn 0.18s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive adjustments ─────────────────────── */
@media (max-width: 960px) {
    .menu-item-emoji { font-size: 2rem; }
    .mud-table-cell  { padding: 8px 6px !important; }
    .drawer-brand-text { font-size: 0.8rem !important; }
}

@media (max-width: 600px) {
    .brand-title { font-size: clamp(1rem, 4vw, 1.5rem) !important; }
    .menu-item-card { min-height: 80px; }
}

/* ═══════════════════════════════════════════════════
   INTERACTION ANIMATIONS
   ═══════════════════════════════════════════════════ */

/* ── Easing tokens ───────────────────────────────── */
:root {
    --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── hover-lift utility (add Class="hover-lift") ─── */
.hover-lift {
    transition: transform 0.22s var(--ease-out-expo),
                box-shadow 0.22s var(--ease-out-expo) !important;
}
.hover-lift:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45) !important;
}
.hover-lift:active {
    transform: translateY(-2px) scale(0.99) !important;
}

/* ── MudCard hover lift (all except kitchen/login/menu-item/caja) */
.mud-card:not(.kitchen-card):not(.login-card):not(.menu-item-card):not(.caja-order-card) {
    transition: transform 0.2s var(--ease-out-expo),
                box-shadow 0.2s var(--ease-out-expo);
}
.mud-card:not(.kitchen-card):not(.login-card):not(.menu-item-card):not(.caja-order-card):hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38) !important;
}

/* ── Caja: order card group focus effect ─────────── */
.caja-order-card {
    transition: transform 0.22s var(--ease-out-expo),
                box-shadow 0.22s var(--ease-out-expo),
                opacity 0.22s ease,
                filter 0.22s ease;
}
.caja-order-grid:hover .caja-order-card {
    opacity: 0.5;
    filter: brightness(0.75) saturate(0.7);
    transform: scale(0.97);
}
.caja-order-grid:hover .caja-order-card:hover {
    opacity: 1;
    filter: brightness(1) saturate(1);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 14px 36px rgba(214, 40, 40, 0.35) !important;
    z-index: 2;
}

/* ── Caja: Cobrar button tablet press effect ──────── */
.caja-cobrar-btn {
    touch-action: manipulation !important;
    position: relative !important;
    overflow: hidden !important;
}
.caja-cobrar-btn:active {
    transform: scale(0.91) !important;
    transition: transform 0.08s ease !important;
}
@keyframes cobrarFlash {
    0%   { opacity: 0; }
    25%  { opacity: 0.35; }
    100% { opacity: 0; }
}
.caja-cobrar-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
    border-radius: inherit;
}
.caja-cobrar-btn:active::after {
    animation: cobrarFlash 0.32s ease forwards;
}

/* ── Button press feedback ───────────────────────── */
.mud-button-root {
    transition: transform 0.1s var(--ease-spring) !important;
}
.mud-button-root:active {
    transform: scale(0.95) !important;
}

/* ── NavLink left-bar indicator ──────────────────── */
.mud-nav-link {
    position: relative;
    overflow: hidden;
    transition: background-color 0.15s ease !important;
}
.mud-nav-link::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--brand-orange);
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.2s var(--ease-spring);
}
.mud-nav-link:hover::before {
    transform: scaleY(1);
}
.mud-nav-link.active::before {
    transform: scaleY(1);
    background: var(--brand-red);
}

/* ── Drawer fire icon bounce on hover ────────────── */
.drawer-logo-icon {
    transition: transform 0.3s var(--ease-spring), color 0.3s ease !important;
}
.drawer-logo:hover .drawer-logo-icon {
    transform: scale(1.25) rotate(-10deg) !important;
    color: var(--brand-yellow) !important;
}

/* ── Icon buttons ────────────────────────────────── */
.mud-icon-button {
    transition: transform 0.15s var(--ease-spring) !important;
}
.mud-icon-button:hover {
    transform: scale(1.18) !important;
}
.mud-icon-button:active {
    transform: scale(0.87) !important;
}

/* ── Chips / badges ──────────────────────────────── */
.mud-chip {
    transition: transform 0.15s var(--ease-spring),
                box-shadow 0.15s ease !important;
}
.mud-chip:hover {
    transform: scale(1.08) translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28) !important;
}

/* ── Input focus glow ────────────────────────────── */
.mud-input-outlined:focus-within {
    box-shadow: 0 0 0 3px rgba(247, 127, 0, 0.22) !important;
    border-radius: 4px;
    transition: box-shadow 0.25s ease !important;
}

/* ── MudAlert entrance ───────────────────────────── */
.mud-alert {
    animation: alertSlideIn 0.32s var(--ease-out-expo) both;
}
@keyframes alertSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Kitchen card entrance ───────────────────────── */
.kitchen-card {
    animation: kitchenCardIn 0.38s var(--ease-out-expo) both;
}
@keyframes kitchenCardIn {
    from { opacity: 0; transform: translateY(-14px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)     scale(1); }
}

/* ── Progress bar shimmer ────────────────────────── */
.mud-progress-linear-bar1 {
    position: relative;
    overflow: hidden;
}
.mud-progress-linear-bar1::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.28) 50%,
        transparent 100%
    );
    transform: translateX(-100%);
    animation: shimmerBar 2.4s ease-in-out infinite;
}
@keyframes shimmerBar {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

/* ── Stagger entrance (add Class="stagger-grid" on MudGrid) */
.stagger-grid > .mud-item {
    animation: fadeInUp 0.36s var(--ease-out-expo) both;
}
.stagger-grid > .mud-item:nth-child(1) { animation-delay: 0.00s; }
.stagger-grid > .mud-item:nth-child(2) { animation-delay: 0.07s; }
.stagger-grid > .mud-item:nth-child(3) { animation-delay: 0.14s; }
.stagger-grid > .mud-item:nth-child(4) { animation-delay: 0.21s; }
.stagger-grid > .mud-item:nth-child(5) { animation-delay: 0.28s; }
.stagger-grid > .mud-item:nth-child(6) { animation-delay: 0.35s; }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Reduced motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration:        0.01ms !important;
        animation-iteration-count: 1      !important;
        transition-duration:       0.01ms !important;
    }
}
