/* Selling Phase Styles - Stand scene, customers, and selling gameplay */

/* Selling Phase Styles */
.lemonade-stand {
    text-align: center;
}

.stand-scene {
    background: url('../assets/lemonade-garage-sunny.png') center/cover no-repeat;
    border: 4px solid #333;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 0.5rem; /* Reduced from 2rem to bring stats box closer */
    position: relative;
    min-height: 500px; /* Increased minimum height */
    max-height: 600px; /* Increased maximum height */
    height: 65vh; /* Slightly increased height */
    box-shadow: 4px 4px 8px rgba(0,0,0,0.3);
    background-color: #87CEEB; /* Light blue fallback color */
    background-size: cover;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: row; /* Changed to row layout */
    justify-content: space-between;
    align-items: flex-end; /* Align items to bottom */
}

.house-background {
    display: none; /* Hidden since we now have real garage background */
    font-size: 6rem;
    position: absolute;
    top: 10px;
    right: 20px;
    opacity: 0.7;
}

.stand-container {
    position: absolute;
    right: 30px; /* Moved even further to the right */
    bottom: 80px; /* Move higher from bottom */
    width: 380px; /* Made bigger */
    flex-shrink: 0;
    z-index: 3; /* Lower z-index than customers */
}

.lemonade-stand-container {
    position: relative;
    width: 100%;
    height: 270px; /* Made bigger */
}

.stand-image {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.garage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.8;
    pointer-events: none;
}

.cups-remaining-overlay {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    border: 3px solid #333;
    box-shadow: 3px 3px 6px rgba(0,0,0,0.4);
    z-index: 30; /* Highest z-index to appear on top of everything */
}

/* Customer Area and Customer Styles */
.customer-area {
    position: absolute;
    bottom: 20px; /* Lowered further from 40px */
    left: 0; /* Perfect fit to left side without margin */
    right: 320px; /* Adjusted for stand moved further right */
    height: 200px; /* Customer area height */
    overflow-x: visible; /* Allow customers to move outside horizontally when leaving */
    overflow-y: hidden; /* Keep customers inside vertically */
    border: none;
    border-radius: 8px;
    background: transparent;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    z-index: 15; /* Higher z-index than stand */
}

.customer {
    background: transparent;
    border: none;
    border-radius: 0;
    width: 150px; /* Made bigger */
    height: 150px; /* Made bigger */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default; /* Remove pointer cursor */
    transition: opacity 1s ease, transform 3s ease; /* Only opacity and transform by default */
    touch-action: none; /* Disable touch interactions */
    -webkit-user-select: none;
    user-select: none;
    opacity: 1;
    position: absolute; /* Allow for overlapping */
    will-change: opacity, transform; /* Optimize for animations */
    pointer-events: none; /* Make completely non-clickable */
    z-index: 20; /* High z-index to appear on top of everything */
}

.customer[data-customer-type="boy"] {
    width: 120px; /* 20% smaller than 150px */
    height: 120px; /* 20% smaller than 150px */
}

.customer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Customer State Styles */
.customer.served {
    transition: transform 3s ease-out, opacity 3s ease-out !important; /* Smooth walking away animation with stronger specificity */
    pointer-events: none;
    z-index: 25; /* Even higher z-index for served customers to ensure visibility during animation */
}

.customer.entering {
    transition: left 2s ease-in-out, top 1s ease-in-out, opacity 1s ease; /* Movement transitions only for entering customers */
    will-change: left, top, opacity; /* Optimize for position animations */
}

.customer.standing {
    transition: left 1s ease, top 1s ease, opacity 0.3s ease; /* Minimal transitions for repositioning */
    will-change: auto; /* Reset will-change for standing customers */
}

.customer.leaving {
    transition: transform 6s ease-out, opacity 3s ease; /* Smooth walking away animation for disappointed customers */
    opacity: 0.5;
    pointer-events: none;
}

/* Selling Stats */
.selling-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem; /* Reduced from 2rem to lower the box */
}

.stat-item {
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.stat-label {
    font-size: 2.5rem;
    line-height: 1;
    margin: 0;
}

.stat-item span:last-child {
    font-size: 1.4rem;
    font-weight: bold;
    color: #333;
}

/* Selling Actions */
.selling-actions {
    text-align: center;
    margin-top: 2rem;
}

.end-day-early-btn {
    background: #ffc107;
    color: #333;
    border: 2px solid #e0a800;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.end-day-early-btn:hover {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.end-day-early-btn:active {
    transform: translateY(0);
}
