/* 🍰 Cake Reward System Styles - 3D ISOMETRIC CAKE VERSION */

/* ========================================
   +1 CAKE POPUP ANIMATION
   ======================================== */

.cake-reward-popup {
    position: fixed;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    pointer-events: none;
    animation: cakeFloat 1.8s ease-out forwards;
    text-align: center;
}

.cake-reward-popup .cake-emoji {
    font-size: 5rem;
    display: block;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

.cake-reward-popup .cake-plus {
    position: absolute;
    top: -5px;
    right: -25px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    padding: 0.35rem 1rem;
    border-radius: 9999px;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
    animation: bounceIn 0.3s ease-out 0.1s both;
}

.cake-reward-popup .cake-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #c97b63;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    border: 2px solid #fcd5ce;
}

@keyframes cakeFloat {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.3);
    }
    25% {
        transform: translate(-50%, -50%) scale(1);
    }
    70% {
        opacity: 1;
        transform: translate(-50%, -70%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -90%) scale(0.8);
    }
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ========================================
   3D ISOMETRIC CAKE CHART
   ======================================== */

.cake-3d-wrapper {
    perspective: 800px;
    width: 260px;
    height: 200px;
    margin: 0 auto 1.5rem;
    position: relative;
}

/* Plate */
.cake-3d-plate {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) rotateX(70deg);
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: linear-gradient(135deg, 
        #f8f8f8 0%, 
        #ffffff 40%, 
        #e8e8e8 100%);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        inset 0 0 30px rgba(0, 0, 0, 0.05);
    border: 3px solid #e0e0e0;
}

/* 3D Cake Container */
.cake-3d-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto;
    transform-style: preserve-3d;
    transform: rotateX(65deg) rotateZ(-30deg);
}

/* Canvas for 3D chart */
#cake-3d-canvas {
    width: 100%;
    height: 100%;
}

/* Fallback CSS-based 3D effect */
.cake-3d-top {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    transform: translateZ(40px);
    overflow: hidden;
}

.cake-3d-side {
    position: absolute;
    width: 180px;
    height: 40px;
    bottom: 0;
    left: 0;
    border-radius: 0 0 90px 90px / 0 0 20px 20px;
    transform: rotateX(90deg) translateZ(90px);
}

/* Simple CSS 3D Cake using stacked layers */
.cake-3d-stack {
    position: relative;
    width: 200px;
    height: 160px;
    margin: 0 auto;
    transform: rotateX(15deg);
    transform-style: preserve-3d;
}

.cake-layer {
    position: absolute;
    width: 180px;
    height: 180px;
    left: 10px;
    border-radius: 50%;
    transform-style: preserve-3d;
}

.cake-layer-top {
    transform: translateY(0) translateZ(0);
}

/* Each slice of the 3D cake */
.cake-3d-slice {
    position: absolute;
    width: 90px;
    height: 90px;
    transform-origin: 100% 100%;
    clip-path: polygon(100% 100%, 0% 100%, 100% 0%);
}

/* ========================================
   3D ISOMETRIC CAKE CHART
   ======================================== */

.cake-chart-container {
    position: relative;
    width: 320px; /* Increased from 280px */
    height: 260px; /* Increased from 220px */
    margin: 0 auto 1.5rem;
}

.cake-3d-svg {
    width: 100%;
    height: 100%;
}

/* Decoration on top */
.cake-decoration {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-size: 2rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
    animation: cherryBounce 2s ease-in-out infinite;
}

@keyframes cherryBounce {
    0%, 100% { transform: translateX(-50%) translateY(0) rotate(-5deg); }
    50% { transform: translateX(-50%) translateY(-5px) rotate(5deg); }
}

/* ========================================
   SCORE DISPLAY - BELOW CAKE
   ======================================== */

.cake-score-box {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #fff 0%, #fff8f6 100%);
    border-radius: 1.5rem;
    border: 3px solid #ffd5cc;
    box-shadow: 
        0 6px 20px rgba(201, 123, 99, 0.15),
        inset 0 -2px 5px rgba(0, 0, 0, 0.03);
    display: inline-block;
}

.cake-score-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #ffb5a7;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.cake-score-value {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    font-family: 'Outfit', sans-serif;
    color: #c97b63;
}

.cake-score-value span {
    font-size: 1.25rem;
    color: #94a3b8;
}

/* Hide old frosting */
.cake-frosting {
    display: none;
}

/* ========================================
   CAKE MESSAGE BOX
   ======================================== */

.cake-message {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem 3rem;
    background: linear-gradient(135deg, #fff8f6 0%, #ffeee8 100%);
    border-radius: 1.5rem;
    border: 2px solid #ffd5cc;
    box-shadow: 0 4px 15px rgba(201, 123, 99, 0.1);
    position: relative;
}

.cake-message::before {
    content: '🍰';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

.cake-message::after {
    content: '🍰';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%) scaleX(-1);
    font-size: 1.5rem;
}

.cake-message-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: #c97b63;
}

.cake-message-emoji {
    font-size: 1.25rem;
    margin-left: 0.5rem;
}

/* ========================================
   ONBOARDING / INTRO SCREEN
   - Mascot on RIGHT, arrow in CENTER
   ======================================== */

.quiz-onboarding {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, #fff8f6 100%);
    border-radius: 2rem;
    border: 3px solid #ffd5cc;
    box-shadow: 0 10px 40px rgba(201, 123, 99, 0.15);
    position: relative;
    overflow: hidden;
}

.quiz-onboarding::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #ffb5a7, #fec89a, #ffb5a7);
}

/* MASCOT ON RIGHT - Flex row-reverse */
.onboarding-mascot {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 1.5rem;
    text-align: left;
}

.onboarding-mascot-img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    flex-shrink: 0;
    animation: mascotWave 1.5s ease-in-out;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

@keyframes mascotWave {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-8deg) scale(1.05); }
    75% { transform: rotate(8deg) scale(1.05); }
}

/* Bubble with arrow pointing RIGHT at CENTER height */
.onboarding-bubble {
    background: white;
    border: 2px solid #ffb5a7;
    border-radius: 1.5rem;
    padding: 1rem 1.25rem;
    position: relative;
    box-shadow: -4px 4px 0px 0px rgba(255, 181, 167, 0.3);
    flex: 1;
}

/* Arrow pointing RIGHT at CENTER (50% from top) */
.onboarding-bubble::before {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 14px solid #ffb5a7;
}

.onboarding-bubble::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 12px solid white;
}

.onboarding-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #c97b63;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.onboarding-text {
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.5;
}

.onboarding-text strong {
    color: #c97b63;
}

.onboarding-cake-preview {
    display: flex;
    justify-content: center;
    gap: 0.2rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #fcd5ce;
}

.cake-slice-icon {
    font-size: 1.25rem;
    opacity: 0.3;
    transition: all 0.3s ease;
}

/* ========================================
   FEEDBACK OVERLAY POSITIONING FIX
   ======================================== */

.feedback-overlay {
    top: 65% !important;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 640px) {
    .cake-chart-container {
        width: 280px; /* Increased from 240px */
        height: 220px; /* Increased from 180px */
    }
    
    .cake-score-value {
        font-size: 2rem;
    }
    
    .cake-reward-popup .cake-emoji {
        font-size: 4rem;
    }
    
    .onboarding-mascot {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .onboarding-mascot-img {
        width: 90px;
        height: 90px;
        order: -1;
    }
    
    .onboarding-bubble {
        border-radius: 1.5rem;
    }
    
    .onboarding-bubble::before,
    .onboarding-bubble::after {
        display: none;
    }
}
