/* Loading Screen Styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f3efe6;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

/* Beer Cup Container */
.beer-cup-loader {
    position: relative;
    width: 120px;
    height: 180px;
}

/* Glass Cup Shape */
.cup {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 150px;
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.4) 0%,
        rgba(255,255,255,0.15) 50%,
        rgba(255,255,255,0.3) 100%
    );
    border: 3px solid rgba(17,17,17,0.25);
    border-radius: 8px 8px 16px 16px;
    overflow: hidden;
    box-shadow: 
        inset 2px 0 8px rgba(255,255,255,0.5),
        inset -2px 0 8px rgba(0,0,0,0.05),
        0 8px 32px rgba(0,0,0,0.08);
}

/* Cup rim highlight */
.cup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.8),
        transparent
    );
    border-radius: 5px 5px 0 0;
}

/* Glass highlight streak */
.cup::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 8px;
    width: 8px;
    height: 100px;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.6),
        rgba(255,255,255,0.2),
        transparent
    );
    border-radius: 4px;
    z-index: 10;
}

/* Beer liquid container */
.beer-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%;
    background: linear-gradient(
        to top,
        #c79a4b 0%,
        #d4a853 20%,
        #f4c430 60%,
        #ffd700 100%
    );
    animation: fill-up 2.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    overflow: hidden;
}

@keyframes fill-up {
    0% { height: 0%; }
    15% { height: 8%; }
    100% { height: 85%; }
}

/* Beer surface wave */
.beer-fill::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -10%;
    width: 120%;
    height: 10px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.3) 25%,
        rgba(255,255,255,0.5) 50%,
        rgba(255,255,255,0.3) 75%,
        transparent 100%
    );
    animation: wave 1.5s ease-in-out infinite;
    border-radius: 50%;
}

@keyframes wave {
    0%, 100% { transform: translateX(-5%) scaleY(1); }
    50% { transform: translateX(5%) scaleY(1.5); }
}

/* Bubbles container */
.bubbles {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    overflow: hidden;
    opacity: 0;
    animation: bubbles-appear 0.3s ease-out 0.5s forwards;
}

@keyframes bubbles-appear {
    to { opacity: 1; }
}

/* Individual bubbles */
.bubble {
    position: absolute;
    bottom: -20px;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
    animation: rise 2s ease-in infinite;
}

.bubble:nth-child(1) {
    left: 20%;
    width: 6px;
    height: 6px;
    animation-delay: 0s;
    animation-duration: 2.2s;
}

.bubble:nth-child(2) {
    left: 40%;
    width: 4px;
    height: 4px;
    animation-delay: 0.3s;
    animation-duration: 1.8s;
}

.bubble:nth-child(3) {
    left: 60%;
    width: 5px;
    height: 5px;
    animation-delay: 0.6s;
    animation-duration: 2s;
}

.bubble:nth-child(4) {
    left: 75%;
    width: 3px;
    height: 3px;
    animation-delay: 0.9s;
    animation-duration: 1.6s;
}

.bubble:nth-child(5) {
    left: 30%;
    width: 4px;
    height: 4px;
    animation-delay: 1.2s;
    animation-duration: 2.1s;
}

.bubble:nth-child(6) {
    left: 50%;
    width: 5px;
    height: 5px;
    animation-delay: 0.4s;
    animation-duration: 1.9s;
}

.bubble:nth-child(7) {
    left: 15%;
    width: 3px;
    height: 3px;
    animation-delay: 0.8s;
    animation-duration: 2.3s;
}

.bubble:nth-child(8) {
    left: 85%;
    width: 4px;
    height: 4px;
    animation-delay: 1.5s;
    animation-duration: 1.7s;
}

@keyframes rise {
    0% {
        bottom: 0;
        opacity: 0.7;
        transform: translateX(0) scale(1);
    }
    50% {
        opacity: 0.5;
        transform: translateX(3px) scale(0.9);
    }
    100% {
        bottom: 100%;
        opacity: 0;
        transform: translateX(-3px) scale(0.6);
    }
}

/* Foam head */
.foam {
    position: absolute;
    top: -2px;
    left: -4px;
    right: -4px;
    height: 30px;
    opacity: 0;
    transform: scaleY(0);
    transform-origin: bottom;
    animation: foam-rise 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 2.2s forwards;
}

@keyframes foam-rise {
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

/* Foam bubbles - layered effect */
.foam-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 2px;
}

.foam-layer:nth-child(1) {
    bottom: 0;
}

.foam-layer:nth-child(2) {
    bottom: 8px;
}

.foam-layer:nth-child(3) {
    bottom: 16px;
}

.foam-bubble {
    background: rgba(255,255,255,0.95);
    border-radius: 50%;
    box-shadow: 
        inset -1px -1px 2px rgba(0,0,0,0.05),
        0 1px 2px rgba(0,0,0,0.03);
}

/* Foam layer 1 - base, largest bubbles */
.foam-layer:nth-child(1) .foam-bubble:nth-child(1) { width: 16px; height: 14px; }
.foam-layer:nth-child(1) .foam-bubble:nth-child(2) { width: 20px; height: 16px; }
.foam-layer:nth-child(1) .foam-bubble:nth-child(3) { width: 18px; height: 14px; }
.foam-layer:nth-child(1) .foam-bubble:nth-child(4) { width: 22px; height: 16px; }
.foam-layer:nth-child(1) .foam-bubble:nth-child(5) { width: 16px; height: 14px; }
.foam-layer:nth-child(1) .foam-bubble:nth-child(6) { width: 14px; height: 12px; }

/* Foam layer 2 - middle */
.foam-layer:nth-child(2) .foam-bubble:nth-child(1) { width: 14px; height: 12px; }
.foam-layer:nth-child(2) .foam-bubble:nth-child(2) { width: 16px; height: 14px; }
.foam-layer:nth-child(2) .foam-bubble:nth-child(3) { width: 18px; height: 14px; }
.foam-layer:nth-child(2) .foam-bubble:nth-child(4) { width: 14px; height: 12px; }
.foam-layer:nth-child(2) .foam-bubble:nth-child(5) { width: 12px; height: 10px; }

/* Foam layer 3 - top, smallest */
.foam-layer:nth-child(3) .foam-bubble:nth-child(1) { width: 10px; height: 8px; }
.foam-layer:nth-child(3) .foam-bubble:nth-child(2) { width: 14px; height: 10px; }
.foam-layer:nth-child(3) .foam-bubble:nth-child(3) { width: 12px; height: 10px; }
.foam-layer:nth-child(3) .foam-bubble:nth-child(4) { width: 8px; height: 7px; }

/* Handle */
.cup-handle {
    position: absolute;
    right: -22px;
    top: 25px;
    width: 24px;
    height: 60px;
    border: 4px solid rgba(17,17,17,0.25);
    border-left: none;
    border-radius: 0 20px 20px 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.2) 100%
    );
}

/* Text Pulse */
.loading-text {
    color: #111111;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0;
    animation: text-fade-in 0.5s ease-out 0.8s forwards,
               pulse 1.5s ease-in-out 1.3s infinite;
}

@keyframes text-fade-in {
    to { opacity: 0.85; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Hidden class for main content */
.hidden {
    display: none;
}

@media (max-width: 480px) {
    .beer-cup-loader {
        transform: scale(0.85);
    }
    
    .loading-text {
        font-size: 1rem;
        letter-spacing: 0.14em;
        text-align: center;
        padding: 0 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .loading-screen *,
    .beer-cup-loader * {
        animation: none !important;
        transition: none !important;
    }

    /* Static state: filled */
    .beer-fill {
        height: 85%;
    }
    
    .foam {
        opacity: 1;
        transform: scaleY(1);
    }
    
    .bubbles {
        opacity: 1;
    }
    
    .loading-text {
        opacity: 0.85;
    }
}
