/**
 * Coffee Shop V2 - Realistic Coffee Effects
 * Phin coffee, pouring, brewing animations
 */

/* ============================================
   COFFEE BEANS - Enhanced Visibility
   ============================================ */

.coffee-bean {
    position: absolute;
    background: radial-gradient(ellipse at 30% 30%, #8B4513, #3E2723);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow:
        inset -3px -3px 6px rgba(0,0,0,0.4),
        3px 3px 8px rgba(0,0,0,0.3);
    animation: floatBean 20s infinite ease-in-out;
    opacity: 0.9 !important;
    z-index: 5;
}

.coffee-bean::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    height: 70%;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
}

/* Center line on bean */
.coffee-bean::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3px;
    height: 80%;
    background: rgba(0,0,0,0.3);
    border-radius: 2px;
}

@keyframes floatBean {
    0%, 100% {
        transform: translateY(100vh) rotate(0deg) scale(1);
        opacity: 0;
    }
    5% {
        opacity: 0.9;
    }
    95% {
        opacity: 0.9;
    }
    100% {
        transform: translateY(-120px) rotate(720deg) scale(0.8);
        opacity: 0;
    }
}

/* ============================================
   VIETNAMESE COFFEE PHIN (Cafe Phin)
   ============================================ */

.coffee-phin {
    position: relative;
    width: 120px;
    height: 150px;
    margin: 2rem auto;
}

/* Phin body */
.phin-body {
    position: relative;
    width: 100px;
    height: 80px;
    background: linear-gradient(180deg, #C0C0C0, #808080);
    border-radius: 0 0 10px 10px;
    margin: 0 auto;
    box-shadow:
        inset 0 -5px 10px rgba(0,0,0,0.3),
        0 5px 15px rgba(0,0,0,0.2);
}

.phin-body::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background: #3E2723;
    border-radius: 5px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

/* Phin lid */
.phin-lid {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 25px;
    background: linear-gradient(180deg, #E0E0E0, #A0A0A0);
    border-radius: 50% 50% 5px 5px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    animation: phinLidOpen 4s infinite;
    transform-origin: left center;
}

.phin-lid::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 10px;
    background: #d4a574;
    border-radius: 5px 5px 0 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

@keyframes phinLidOpen {
    0%, 30% {
        transform: translateX(-50%) rotateX(0deg);
    }
    35%, 65% {
        transform: translateX(-50%) rotateX(-60deg);
    }
    70%, 100% {
        transform: translateX(-50%) rotateX(0deg);
    }
}

/* Phin press */
.phin-press {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 85px;
    height: 15px;
    background: linear-gradient(180deg, #B0B0B0, #707070);
    border-radius: 50%;
    box-shadow: 0 3px 5px rgba(0,0,0,0.3);
    animation: phinPressDown 4s infinite;
}

@keyframes phinPressDown {
    0%, 30% {
        top: 30px;
    }
    35%, 65% {
        top: 45px;
    }
    70%, 100% {
        top: 30px;
    }
}

/* Coffee dripping from phin */
.phin-drip {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
}

.phin-drip::before,
.phin-drip::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 0;
    background: linear-gradient(to bottom, #3E2723, #2C1810);
    border-radius: 0 0 2px 2px;
    animation: coffeeDrip 2s infinite;
}

.phin-drip::before {
    left: -15px;
    animation-delay: 0.3s;
}

.phin-drip::after {
    left: 15px;
    animation-delay: 0.6s;
}

@keyframes coffeeDrip {
    0% {
        height: 0;
        opacity: 0;
    }
    10% {
        height: 20px;
        opacity: 1;
    }
    20% {
        height: 30px;
        opacity: 0.8;
    }
    30%, 100% {
        height: 40px;
        opacity: 0;
    }
}

/* ============================================
   COFFEE POURING ANIMATION
   ============================================ */

.coffee-pour-container {
    position: relative;
    width: 200px;
    height: 300px;
    margin: 2rem auto;
}

/* Coffee pot */
.coffee-pot {
    position: absolute;
    top: 0;
    right: 20px;
    width: 80px;
    height: 100px;
    animation: pourTilt 6s infinite;
    transform-origin: bottom right;
}

.pot-body {
    width: 60px;
    height: 80px;
    background: linear-gradient(135deg, #2C1810, #3E2723);
    border-radius: 10px 10px 15px 15px;
    position: relative;
    box-shadow:
        inset -3px -3px 8px rgba(0,0,0,0.4),
        3px 3px 10px rgba(0,0,0,0.3);
}

.pot-body::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 15px;
    background: #2C1810;
    border-radius: 10px 10px 0 0;
}

.pot-spout {
    position: absolute;
    right: -15px;
    top: 40px;
    width: 20px;
    height: 3px;
    background: #2C1810;
    border-radius: 0 10px 10px 0;
}

.pot-handle {
    position: absolute;
    left: -25px;
    top: 20px;
    width: 30px;
    height: 50px;
    border: 4px solid #3E2723;
    border-left: none;
    border-radius: 0 50% 50% 0;
}

/* Coffee stream */
.coffee-stream {
    position: absolute;
    top: 43px;
    right: -30px;
    width: 8px;
    height: 0;
    background: linear-gradient(to bottom, #3E2723, #2C1810);
    border-radius: 4px;
    animation: streamPour 6s infinite;
    transform-origin: top center;
}

@keyframes pourTilt {
    0%, 20% {
        transform: rotate(0deg);
    }
    25%, 75% {
        transform: rotate(45deg);
    }
    80%, 100% {
        transform: rotate(0deg);
    }
}

@keyframes streamPour {
    0%, 20% {
        height: 0;
        opacity: 0;
    }
    25% {
        height: 150px;
        opacity: 1;
    }
    75% {
        height: 150px;
        opacity: 1;
    }
    80%, 100% {
        height: 0;
        opacity: 0;
    }
}

/* Coffee glass */
.coffee-glass {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 120px;
}

.glass-body {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, transparent, rgba(62, 39, 35, 0.1));
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 0 0 10px 10px;
    position: relative;
    overflow: hidden;
    box-shadow:
        inset 0 -5px 15px rgba(62, 39, 35, 0.2),
        0 5px 15px rgba(0,0,0,0.2);
}

/* Coffee liquid filling */
.coffee-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
    background: linear-gradient(180deg, #3E2723, #2C1810);
    border-radius: 0 0 7px 7px;
    animation: fillGlass 6s infinite;
}

.coffee-liquid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: radial-gradient(ellipse at center, rgba(212,175,55,0.3), transparent);
    animation: liquidRipple 2s infinite;
}

@keyframes fillGlass {
    0%, 20% {
        height: 0;
    }
    80%, 100% {
        height: 90%;
    }
}

@keyframes liquidRipple {
    0%, 100% {
        transform: scale(0.9);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* ============================================
   COFFEE CUP WITH STEAM - Enhanced
   ============================================ */

.coffee-cup-3d {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 2rem auto;
}

.cup-body {
    width: 80px;
    height: 70px;
    background: linear-gradient(180deg, #FFFFFF, #E0E0E0);
    border-radius: 0 0 15px 15px;
    position: relative;
    box-shadow:
        inset 0 -10px 20px rgba(62, 39, 35, 0.3),
        0 10px 20px rgba(0,0,0,0.2);
}

.cup-handle {
    position: absolute;
    right: -25px;
    top: 15px;
    width: 30px;
    height: 40px;
    border: 5px solid #E0E0E0;
    border-left: none;
    border-radius: 0 50% 50% 0;
    box-shadow: 3px 3px 10px rgba(0,0,0,0.2);
}

.cup-coffee-surface {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    height: 8px;
    background: radial-gradient(ellipse at center, #3E2723, #2C1810);
    border-radius: 50%;
    overflow: hidden;
}

.cup-coffee-surface::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 20%;
    width: 15px;
    height: 15px;
    background: radial-gradient(circle, rgba(255,255,255,0.3), transparent);
    border-radius: 50%;
    animation: coffeeReflection 3s infinite;
}

@keyframes coffeeReflection {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translate(10px, -2px) scale(1.2);
        opacity: 0.6;
    }
}

/* Enhanced steam */
.steam-enhanced {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 80px;
}

.steam-enhanced .steam-particle {
    position: absolute;
    width: 6px;
    height: 20px;
    background: linear-gradient(to top, rgba(255,255,255,0.7), transparent);
    border-radius: 50%;
    filter: blur(2px);
    animation: steamRise 3s infinite ease-out;
}

.steam-enhanced .steam-particle:nth-child(1) {
    left: 20%;
    animation-delay: 0s;
}

.steam-enhanced .steam-particle:nth-child(2) {
    left: 50%;
    animation-delay: 0.5s;
}

.steam-enhanced .steam-particle:nth-child(3) {
    left: 80%;
    animation-delay: 1s;
}

@keyframes steamRise {
    0% {
        bottom: 0;
        opacity: 0;
        transform: translateX(0) scaleX(1);
    }
    20% {
        opacity: 0.7;
    }
    100% {
        bottom: 80px;
        opacity: 0;
        transform: translateX(20px) scaleX(2);
    }
}

/* ============================================
   COFFEE GRINDER ANIMATION
   ============================================ */

.coffee-grinder {
    position: relative;
    width: 100px;
    height: 140px;
    margin: 2rem auto;
}

.grinder-top {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8B4513, #654321);
    border-radius: 50% 50% 10px 10px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.grinder-handle {
    position: absolute;
    top: 10px;
    left: -20px;
    width: 40px;
    height: 10px;
    background: #654321;
    border-radius: 5px;
    animation: grindRotate 2s infinite linear;
    transform-origin: right center;
}

.grinder-handle::before {
    content: '';
    position: absolute;
    left: -10px;
    top: -3px;
    width: 15px;
    height: 15px;
    background: #d4a574;
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

@keyframes grindRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.grinder-body {
    width: 80px;
    height: 70px;
    background: linear-gradient(180deg, #D2691E, #8B4513);
    border-radius: 10px;
    margin: 5px auto 0;
    box-shadow:
        inset 0 -5px 10px rgba(0,0,0,0.3),
        0 10px 20px rgba(0,0,0,0.2);
}

.grinder-drawer {
    width: 70px;
    height: 15px;
    background: #654321;
    border-radius: 5px;
    margin: 5px auto;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    position: relative;
}

.grinder-drawer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 3px;
    background: #d4a574;
    border-radius: 2px;
}

/* Ground coffee particles */
.ground-coffee-particle {
    position: absolute;
    bottom: -20px;
    left: 50%;
    width: 3px;
    height: 3px;
    background: #3E2723;
    border-radius: 50%;
    animation: particleFall 2s infinite;
}

.ground-coffee-particle:nth-child(1) {
    animation-delay: 0.2s;
    margin-left: -10px;
}

.ground-coffee-particle:nth-child(2) {
    animation-delay: 0.4s;
}

.ground-coffee-particle:nth-child(3) {
    animation-delay: 0.6s;
    margin-left: 10px;
}

@keyframes particleFall {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(30px);
        opacity: 0;
    }
}

/* ============================================
   ESPRESSO MACHINE
   ============================================ */

.espresso-machine {
    position: relative;
    width: 150px;
    height: 200px;
    margin: 2rem auto;
}

.machine-body {
    width: 120px;
    height: 150px;
    background: linear-gradient(135deg, #2C3E50, #34495E);
    border-radius: 10px;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    position: relative;
}

.machine-head {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 40px;
    background: linear-gradient(180deg, #34495E, #2C3E50);
    border-radius: 20px 20px 0 0;
}

.machine-spout {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 30px;
    background: #2C3E50;
    border-radius: 5px 5px 0 0;
}

.espresso-shot {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 0;
    background: linear-gradient(to bottom, #8B4513, #3E2723);
    animation: espressoFlow 4s infinite;
}

@keyframes espressoFlow {
    0%, 30% {
        height: 0;
        opacity: 0;
    }
    35% {
        height: 40px;
        opacity: 1;
    }
    70% {
        height: 40px;
        opacity: 1;
    }
    75%, 100% {
        height: 0;
        opacity: 0;
    }
}

/* Cup under machine */
.espresso-cup {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 40px;
    background: linear-gradient(180deg, #FFF, #E0E0E0);
    border-radius: 0 0 10px 10px;
    box-shadow: inset 0 -5px 10px rgba(139, 69, 19, 0.3);
}

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

@media (max-width: 768px) {
    .coffee-phin,
    .coffee-pour-container,
    .coffee-grinder,
    .espresso-machine {
        transform: scale(0.8);
    }

    .coffee-bean {
        display: none;
    }
}
