@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;800&display=swap');

:root {
    --space-black: #040612;
    --deep-space: #080d22;
    --panel-bg: rgba(8, 12, 30, 0.82);
    --panel-bg-strong: rgba(5, 8, 20, 0.94);
    --star-cyan: #20f7ff;
    --nebula-pink: #ff2bd6;
    --nebula-violet: #7c3cff;
    --plasma-green: #74ffbd;
    --solar-yellow: #fff04d;
    --warning-orange: #ffb347;
    --moon-white: #eef7ff;
    --muted-star: rgba(238, 247, 255, 0.72);
    --line-soft: rgba(32, 247, 255, 0.28);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
    padding-bottom: 120px;
    color: var(--moon-white);
    font-family: 'Orbitron', sans-serif;
    background:
        radial-gradient(circle at 12% 12%, rgba(124, 60, 255, 0.36), transparent 26%),
        radial-gradient(circle at 88% 18%, rgba(32, 247, 255, 0.22), transparent 24%),
        radial-gradient(circle at 58% 82%, rgba(255, 43, 214, 0.24), transparent 32%),
        linear-gradient(135deg, var(--space-black), var(--deep-space) 52%, #02030a);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-image:
        radial-gradient(circle, rgba(255,255,255,0.95) 0 1px, transparent 1.5px),
        radial-gradient(circle, rgba(32,247,255,0.76) 0 1px, transparent 1.5px),
        radial-gradient(circle, rgba(255,43,214,0.58) 0 1px, transparent 1.5px);
    background-position: 16px 22px, 68px 92px, 132px 46px;
    background-size: 118px 118px, 174px 174px, 242px 242px;
    opacity: 0.68;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(rgba(255,255,255,0.032) 1px, transparent 1px),
        linear-gradient(90deg, rgba(32,247,255,0.028) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(circle at center, black 0 54%, transparent 84%);
}

.container {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 12px 10px 10px;
    background:
        linear-gradient(180deg, rgba(4,6,18,0.96), rgba(4,6,18,0.72) 68%, transparent);
    backdrop-filter: blur(12px);
}

.container a {
    text-decoration: none;
}

.container button,
.mostrar-btn,
.reiniciar-btn {
    min-height: 42px;
    border: 1px solid rgba(32, 247, 255, 0.86);
    border-radius: 8px;
    padding: 10px 16px;
    color: var(--moon-white);
    background:
        linear-gradient(135deg, rgba(32,247,255,0.18), rgba(255,43,214,0.16)),
        rgba(5, 8, 20, 0.76);
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow:
        0 0 14px rgba(32, 247, 255, 0.34),
        inset 0 0 16px rgba(124, 60, 255, 0.16);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.container button:hover,
.mostrar-btn:hover,
.reiniciar-btn:hover {
    transform: translateY(-2px);
    border-color: var(--nebula-pink);
    box-shadow:
        0 0 22px rgba(32, 247, 255, 0.58),
        0 0 30px rgba(255, 43, 214, 0.38),
        inset 0 0 18px rgba(255, 43, 214, 0.16);
}

.container .boton-ordenar {
    border-color: rgba(116, 255, 189, 0.86);
    box-shadow:
        0 0 14px rgba(116, 255, 189, 0.34),
        inset 0 0 16px rgba(32, 247, 255, 0.12);
}

h1 {
    margin: 18px auto 12px;
    padding: 0 12px;
    color: var(--moon-white);
    font-size: clamp(2rem, 8vw, 4.2rem);
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow:
        0 0 10px rgba(32, 247, 255, 0.88),
        0 0 24px rgba(124, 60, 255, 0.72),
        0 0 46px rgba(255, 43, 214, 0.46);
}

h1::after {
    content: "";
    display: block;
    width: min(460px, 82vw);
    height: 2px;
    margin: 16px auto 0;
    background: linear-gradient(90deg, transparent, var(--star-cyan), var(--nebula-pink), transparent);
    box-shadow: 0 0 18px rgba(32, 247, 255, 0.7);
}

.products-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 14px;
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 12px;
}

.product {
    position: relative;
    overflow: hidden;
    min-height: 266px;
    border: 1px solid rgba(32, 247, 255, 0.58);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.07), transparent 32%),
        var(--panel-bg);
    box-shadow:
        0 0 0 1px rgba(255, 43, 214, 0.18),
        0 12px 32px rgba(0, 0, 0, 0.42),
        0 0 22px rgba(32, 247, 255, 0.18),
        inset 0 0 24px rgba(124, 60, 255, 0.13);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.product::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(125deg, transparent, rgba(32,247,255,0.10), transparent 42%),
        radial-gradient(circle at 50% 0, rgba(255,43,214,0.18), transparent 38%);
}

.product:hover {
    transform: translateY(-4px);
    border-color: var(--nebula-pink);
    box-shadow:
        0 16px 42px rgba(0, 0, 0, 0.48),
        0 0 26px rgba(32, 247, 255, 0.38),
        0 0 34px rgba(255, 43, 214, 0.28);
}

.product img {
    display: block;
    width: 100%;
    height: 112px;
    object-fit: cover;
    border-bottom: 1px solid rgba(32, 247, 255, 0.35);
    filter: saturate(0.86) contrast(1.08);
    transition: filter 0.2s ease, transform 0.2s ease;
}

.product:hover img {
    filter: saturate(1.08) contrast(1.08);
    transform: scale(1.02);
}

.product-content {
    position: relative;
    z-index: 1;
    padding: 10px 8px 12px;
    text-align: center;
}

.product h3 {
    min-height: 36px;
    margin: 0 0 6px;
    color: var(--plasma-green);
    font-size: 12px;
    line-height: 1.18;
    text-shadow:
        0 0 8px rgba(116, 255, 189, 0.62),
        0 0 16px rgba(32, 247, 255, 0.28);
}

.product .precio {
    margin: 3px 0 8px;
    color: var(--solar-yellow);
    font-size: 13px;
    font-weight: 800;
    text-shadow: 0 0 10px rgba(255, 240, 77, 0.56);
}

.existencia {
    min-height: 15px;
    margin: 0 0 4px;
    color: var(--warning-orange);
    font-size: 0.72rem;
    font-style: italic;
    text-decoration: line-through;
    text-shadow: 0 0 8px rgba(255, 179, 71, 0.55);
}

.quantity-controls {
    display: grid;
    grid-template-columns: 34px 44px 34px;
    justify-content: center;
    align-items: center;
    gap: 7px;
    margin: 6px 0;
}

.quantity-controls button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(32, 247, 255, 0.68);
    border-radius: 8px;
    background: rgba(2, 5, 16, 0.72);
    cursor: pointer;
    box-shadow: inset 0 0 12px rgba(32, 247, 255, 0.10);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.quantity-controls button:hover {
    transform: scale(1.05);
    box-shadow:
        0 0 14px rgba(32, 247, 255, 0.45),
        inset 0 0 12px rgba(255, 43, 214, 0.12);
}

.quantity-controls button:disabled {
    opacity: 0.32;
    cursor: not-allowed;
}

.quantity-controls button img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.quantity-controls input {
    width: 44px;
    height: 34px;
    border: 1px solid rgba(255, 43, 214, 0.72);
    border-radius: 8px;
    color: var(--moon-white);
    background: rgba(2, 5, 16, 0.82);
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.38);
}

.quantity-controls input:focus {
    border-color: var(--star-cyan);
    outline: none;
    box-shadow:
        0 0 12px rgba(32, 247, 255, 0.35),
        inset 0 0 12px rgba(124, 60, 255, 0.16);
}

.subtotal {
    margin: 7px 0 0;
    color: var(--solar-yellow);
    font-size: 0.86rem;
    font-weight: 800;
    text-shadow: 0 0 8px rgba(255, 240, 77, 0.42);
}

.oferta {
    position: absolute;
    top: 8px;
    left: 50%;
    z-index: 3;
    transform: translateX(-50%);
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    color: #061018;
    background: linear-gradient(90deg, var(--solar-yellow), var(--plasma-green));
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
    box-shadow: 0 0 18px rgba(116, 255, 189, 0.55);
}

form > div[style*="text-align"] {
    position: sticky;
    bottom: 0;
    z-index: 16;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 0 0 !important;
    padding: 12px;
    border-top: 1px solid rgba(32, 247, 255, 0.44);
    background: rgba(4, 6, 18, 0.88);
    backdrop-filter: blur(14px);
    box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.42);
}

form > div[style*="text-align"] span {
    color: var(--plasma-green) !important;
    font-size: 18px !important;
    font-weight: 800;
    text-shadow: 0 0 12px rgba(116, 255, 189, 0.48);
}

#modalConfirmacion {
    z-index: 1000;
    padding: 16px;
    backdrop-filter: blur(8px);
}

#modalConfirmacion > div {
    width: min(94vw, 520px);
    max-height: 88vh;
    overflow: auto;
    border-color: var(--star-cyan) !important;
    border-radius: 8px !important;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.08), transparent 28%),
        var(--panel-bg-strong) !important;
    box-shadow:
        0 0 0 1px rgba(255, 43, 214, 0.22),
        0 0 34px rgba(32, 247, 255, 0.36),
        inset 0 0 32px rgba(124, 60, 255, 0.16) !important;
}

#modalConfirmacion table {
    border-collapse: collapse;
}

#modalConfirmacion th,
#modalConfirmacion td {
    padding: 8px;
    border-bottom: 1px solid rgba(32, 247, 255, 0.25);
}

.modal-buttons-close,
#modalConfirmacion input[type="button"] {
    min-height: 40px;
    margin: 4px;
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
}

.encargos-container {
    width: min(760px, calc(100% - 24px));
    margin: 26px auto 0;
    padding: 16px;
    border: 1px solid rgba(116, 255, 189, 0.62);
    border-radius: 8px;
    background: rgba(5, 8, 20, 0.68);
    text-align: center;
    box-shadow:
        0 0 18px rgba(116, 255, 189, 0.22),
        inset 0 0 18px rgba(32, 247, 255, 0.08);
}

.encargos-container h2 {
    margin: 0;
    color: var(--moon-white);
    font-size: clamp(0.9rem, 4vw, 1.4rem);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.encargos-container span {
    color: var(--plasma-green);
    text-shadow: 0 0 12px rgba(116, 255, 189, 0.56);
}

@media (max-width: 680px) {
    body {
        padding-bottom: 104px;
    }

    .container {
        gap: 8px;
    }

    .container button,
    .mostrar-btn,
    .reiniciar-btn {
        min-height: 38px;
        padding: 8px 10px;
        font-size: 11px;
    }

    .products-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 10px;
    }

    .product {
        min-height: 252px;
    }

    .product img {
        height: 98px;
    }

    .product h3 {
        font-size: 11px;
    }

    .quantity-controls {
        grid-template-columns: 32px 40px 32px;
        gap: 5px;
    }

    .quantity-controls button,
    .quantity-controls input {
        height: 32px;
    }
}

@media (min-width: 980px) {
    .products-container {
        grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
    }

    .product img {
        height: 130px;
    }
}
