﻿/* ============================================
   RUTA DE PREMIOS — PIZZA VIEW
   Mobile-first alternative visualization
   ============================================ */

/* ---- VIEW TOGGLE ---- */
.view-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px auto 0;
    max-width: 280px;
}

.view-toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #f5f5f5;
    color: #888;
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.view-toggle-btn.active {
    background: var(--brand-red, #EA7600);
    border-color: var(--brand-red, #EA7600);
    color: #fff;
    box-shadow: 0 4px 14px rgba(234, 118, 0, 0.35);
}

.view-toggle-btn:not(.active):hover {
    background: #eee;
    border-color: #ccc;
    color: #555;
}

body.dark-theme .view-toggle-btn {
    background: #1a1a1a;
    border-color: #333;
    color: #666;
}

body.dark-theme .view-toggle-btn.active {
    background: var(--brand-red, #EA7600);
    border-color: var(--brand-red, #EA7600);
    color: #fff;
}

body.dark-theme .view-toggle-btn:not(.active):hover {
    background: #252525;
    color: #999;
}

.view-toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

/* ---- PIZZA VIEW CONTAINER ---- */
.pizza-view {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px 40px;
    gap: 0;
    width: 100%;
}

.pizza-view.active {
    display: flex;
}

.prize-route.active {
    display: flex;
}

.prize-route:not(.active) {
    display: none;
}

/* ---- PIZZA SCENE ---- */
.pizza-scene {
    position: relative;
    width: 85vw;
    height: 85vw;
    max-width: 420px;
    max-height: 420px;
    margin: 0 auto;
    flex-shrink: 0;
}

/* ---- BOARD LAYER (bottom) ---- */
.board-layer {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
    z-index: 1;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 0 30px rgba(0, 0, 0, 0.1);
}

.board-layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
}

/* ---- PIZZA LAYER (top, masked) ---- */
.pizza-layer {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
    z-index: 2;
    transition: mask-image 0.8s ease, -webkit-mask-image 0.8s ease;
    /* Default — full pizza visible */
    -webkit-mask-image: conic-gradient(from 0deg, black 0deg, black 360deg);
    mask-image: conic-gradient(from 0deg, black 0deg, black 360deg);
}

.pizza-layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
}

/* ---- PIZZA BORDER RING ---- */
.pizza-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 4px solid #444;
    z-index: 3;
    pointer-events: none;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

body.dark-theme .pizza-ring {
    border-color: #555;
    box-shadow:
        0 0 20px rgba(234, 118, 0, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ---- PROGRESS ARC ---- */
.progress-arc {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    z-index: 4;
    pointer-events: none;
}

.progress-arc svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-arc-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 3;
}

body.dark-theme .progress-arc-bg {
    stroke: rgba(255, 255, 255, 0.05);
}

.progress-arc-fill {
    fill: none;
    stroke: var(--brand-red, #EA7600);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 6px rgba(234, 118, 0, 0.5));
}

body.dark-theme .progress-arc-fill {
    stroke: #FF6B35;
    filter: drop-shadow(0 0 8px rgba(255, 107, 53, 0.6));
}

/* ---- CENTER INFO ---- */
.pizza-center-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 50%;
    width: 30%;
    height: 30%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.pizza-center-pct {
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    font-family: var(--font-display, 'Montserrat', sans-serif);
}

.pizza-center-label {
    font-size: 0.55rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pizza-center-pts {
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--brand-red, #EA7600);
    margin-top: 1px;
}

/* ---- PRIZE MARKERS (around circle) ---- */
.pizza-markers {
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: none;
}

.pizza-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin-left: -25px;
    margin-top: -25px;
    pointer-events: auto;
    cursor: pointer;
    z-index: 20;
    /* Positioned via JS transform */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.marker-bubble {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #555;
    background: #1a1a1a;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.marker-bubble img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
}

/* Lock overlay on marker */
.marker-lock {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    border-radius: 50%;
    transition: opacity 0.3s ease;
}

/* UNLOCKED marker */
.pizza-marker.unlocked .marker-bubble {
    border-color: var(--brand-red, #EA7600);
    box-shadow:
        0 0 12px rgba(234, 118, 0, 0.6),
        0 3px 12px rgba(0, 0, 0, 0.3);
}

.pizza-marker.unlocked .marker-lock {
    background: rgba(46, 125, 50, 0.7);
}

body.dark-theme .pizza-marker.unlocked .marker-bubble {
    border-color: #ff4444;
    box-shadow:
        0 0 18px rgba(255, 68, 68, 0.7),
        0 3px 12px rgba(0, 0, 0, 0.5);
}

/* REDEEMED marker */
.pizza-marker.redeemed .marker-bubble {
    border-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.4);
}

.pizza-marker.redeemed .marker-lock {
    background: rgba(76, 175, 80, 0.75);
}

/* LOCKED marker */
.pizza-marker.locked .marker-bubble {
    border-color: #444;
    filter: grayscale(0.7) brightness(0.6);
}

/* CURRENT TARGET marker */
.pizza-marker.current-target .marker-bubble {
    animation: markerPulse 2s infinite;
}

@keyframes markerPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(234, 118, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(234, 118, 0, 0), 0 3px 12px rgba(0, 0, 0, 0.3);
    }
}

/* Marker threshold label */
.marker-label {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.55rem;
    font-weight: 800;
    color: #555;
    background: rgba(255, 255, 255, 0.9);
    padding: 1px 6px;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

body.dark-theme .marker-label {
    background: rgba(26, 26, 26, 0.9);
    color: #ccc;
    border-color: #444;
}

.pizza-marker.unlocked .marker-label {
    color: var(--brand-red, #EA7600);
    border-color: var(--brand-red, #EA7600);
}

/* Marker name tooltip on hover */
.marker-name {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    white-space: nowrap;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.8);
    padding: 3px 8px;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pizza-marker:hover .marker-name {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ---- PRIZE LIST (below pizza) ---- */
.pizza-prize-list {
    width: 100%;
    max-width: 420px;
    margin: 24px auto 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pizza-prize-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border-radius: 14px;
    border: 2px solid #eee;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.pizza-prize-item:hover {
    border-color: #ccc;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

body.dark-theme .pizza-prize-item {
    background: #1a1a1a;
    border-color: #2a2a2a;
}

body.dark-theme .pizza-prize-item:hover {
    border-color: #444;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Progress fill behind item */
.pizza-prize-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--fill-pct, 0%);
    background: linear-gradient(90deg, rgba(234, 118, 0, 0.06), rgba(234, 118, 0, 0.02));
    transition: width 0.8s ease;
    pointer-events: none;
}

body.dark-theme .pizza-prize-item::before {
    background: linear-gradient(90deg, rgba(234, 118, 0, 0.15), rgba(234, 118, 0, 0.03));
}

.pizza-prize-item.unlocked::before {
    width: 100% !important;
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.08), rgba(76, 175, 80, 0.02));
}

body.dark-theme .pizza-prize-item.unlocked::before {
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.15), rgba(76, 175, 80, 0.03));
}

.prize-item-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid #333;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.pizza-prize-item.locked .prize-item-img {
    filter: grayscale(0.7) brightness(0.6);
    border-color: #555;
}

.pizza-prize-item.unlocked .prize-item-img {
    border-color: var(--brand-red, #EA7600);
    box-shadow: 0 0 8px rgba(234, 118, 0, 0.3);
}

.pizza-prize-item.redeemed .prize-item-img {
    border-color: #4CAF50;
}

.prize-item-info {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.prize-item-name {
    font-size: 0.8rem;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-theme .prize-item-name {
    color: #e0e0e0;
}

.prize-item-pts {
    font-size: 0.65rem;
    font-weight: 600;
    color: #888;
}

.prize-item-status {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    position: relative;
    z-index: 1;
}

.prize-item-status.locked {
    background: #f1f1f1;
    color: #999;
}

body.dark-theme .prize-item-status.locked {
    background: #252525;
    color: #666;
}

.prize-item-status.unlocked {
    background: rgba(234, 118, 0, 0.1);
    color: var(--brand-red, #EA7600);
}

.prize-item-status.redeemed {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

/* ---- CHOICE GROUP IN LIST ---- */
.pizza-choice-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 2px solid #eee;
    border-radius: 16px;
    padding: 6px;
    background: #fafafa;
}

body.dark-theme .pizza-choice-group {
    border-color: #2a2a2a;
    background: #111;
}

.pizza-choice-group .pizza-prize-item {
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 12px;
}

.choice-group-label {
    font-size: 0.6rem;
    font-weight: 800;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 10px;
}

/* ---- START / FINISH LINE ---- */
.pizza-startline {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.startline-tick {
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, #FFD700, #FF8C00);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

body.dark-theme .startline-tick {
    background: linear-gradient(180deg, #FFD700, #FF6B35);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

.startline-labels {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.startline-zero {
    font-size: 0.55rem;
    font-weight: 900;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

body.dark-theme .startline-zero {
    background: rgba(255, 255, 255, 0.15);
}

.startline-arrow {
    font-size: 0.7rem;
    color: #FFD700;
    filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.5));
    /* Points clockwise (right) to show direction */
}

/* ---- RESPONSIVE ---- */
@media (max-width: 480px) {
    .pizza-scene {
        width: 88vw;
        height: 88vw;
    }

    .pizza-center-pct {
        font-size: 1.2rem;
    }

    .pizza-center-label {
        font-size: 0.5rem;
    }

    .pizza-center-pts {
        font-size: 0.55rem;
    }

    .pizza-marker {
        width: 40px;
        height: 40px;
        margin-left: -20px;
        margin-top: -20px;
    }

    .marker-label {
        font-size: 0.5rem;
        bottom: -16px;
    }

    .marker-name {
        font-size: 0.5rem;
        top: -20px;
        max-width: 90px;
    }

    .view-toggle {
        max-width: 260px;
    }

    .view-toggle-btn {
        padding: 8px 10px;
        font-size: 0.72rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .pizza-scene {
        width: 65vw;
        height: 65vw;
    }
}

@media (min-width: 769px) {
    .pizza-scene {
        width: 420px;
        height: 420px;
    }

    .pizza-marker {
        width: 56px;
        height: 56px;
        margin-left: -28px;
        margin-top: -28px;
    }
}

/* ---- CONSUMED SLICE REVEAL ANIMATION ---- */
@keyframes sliceReveal {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pizza-view.active {
    animation: sliceReveal 0.5s ease;
}

/* ---- COMPLETION OVERLAY ---- */
.pizza-complete-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.pizza-complete-overlay.visible {
    opacity: 1;
}

.pizza-complete-text {
    font-size: 2rem;
    text-align: center;
    line-height: 1.2;
}