/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #FFD700;
    --secondary-color: #FF6B6B;
    --tertiary-color: #4ECDC4;
    --background-color: #f8edd6; /* Light creamy background */
    --dark-color: #343A40;
    --light-color: #FFFFFF;
    --card-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    --border-radius: 20px;
    --header-bg: #FFA07A; /* Soft salmon color for a fun cartoon feel */
    --main-bg: #FDE68A; /* Warm pastel yellow */
}

body {
    font-family: 'Comic Neue', cursive;
    color: var(--dark-color);
    overflow-x: hidden;
    background-color: var(--background-color);
    position: relative;
    min-height: 100vh;
    -webkit-overflow-scrolling: touch; /* For smooth scrolling on iOS */
}

/* Header Styles */
header {
    background-color: var(--header-bg);
    padding: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 5px dashed var(--tertiary-color);
    border-radius: 0 0 30px 30px;
}

/* Money Rain Animation */
.money-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.money {
    position: absolute;
    width: 50px;
    height: 30px;
    background-image: url('https://cdn-icons-png.flaticon.com/512/2489/2489756.png');
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.7;
    transform: rotate(0deg);
    animation: fall linear infinite;
}

@keyframes fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
    }
}

/* Slidable Cart Styles */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100vh;
    background-color: var(--light-color);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: right 0.3s ease-in-out;
    overflow-y: auto;
    padding: 20px;
    border-left: 5px dashed var(--tertiary-color);
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

.cart-sidebar.open {
    right: 0;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.cart-overlay.active {
    display: block;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cart-header h2 {
    font-family: 'Fredoka One', cursive;
    color: var(--secondary-color);
    font-size: 1.8rem;
    text-shadow: 1px 1px 0 var(--dark-color);
}

.close-cart-btn {
    background-color: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--dark-color);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.close-cart-btn:hover {
    transform: scale(1.1);
}

.cart-button {
    background-color: var(--secondary-color);
    color: var(--light-color);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    border: 2px solid var(--dark-color);
    position: relative;
    margin-left: 15px;
    animation: pulse 2s infinite;
}

.cart-button:hover {
    transform: scale(1.1);
    animation: none;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 107, 107, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
}

.cart-button::after {
    content: 'CART';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    background-color: var(--dark-color);
    color: var(--light-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-button:hover::after {
    opacity: 1;
}

/* Cart notification bubble fix for larger numbers */
.cart-notification {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--primary-color);
    color: var(--dark-color);
    font-size: 14px;
    font-weight: bold;
    min-width: 22px;
    height: 22px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--dark-color);
    transition: transform 0.3s ease;
    padding: 0 4px;
}

.cart-notification.active {
    animation: bounce 0.5s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Header Styles */
header {
    background-color: var(--header-bg);
    background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M50 50c0-5.523 4.477-10 10-10s10 4.477 10 10-4.477 10-10 10c0 5.523-4.477 10-10 10s-10-4.477-10-10 4.477-10 10-10zM10 10c0-5.523 4.477-10 10-10s10 4.477 10 10-4.477 10-10 10c0 5.523-4.477 10-10 10S0 25.523 0 20s4.477-10 10-10zm10 8c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zm40 40c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8z' /%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    padding: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px dashed var(--tertiary-color);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.logo-img {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.3));
}

h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.3rem;
    color: var(--light-color);
    text-shadow: 3px 3px 0 var(--dark-color), -1px -1px 0 var(--dark-color), 1px -1px 0 var(--dark-color), -1px 1px 0 var(--dark-color);
}

.money-meter-container {
    max-width: 800px;
    margin: 0 auto;
}

.money-meter {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--card-shadow);
    border: 3px solid var(--tertiary-color);
    position: relative;
}

.ambani-avatar {
    position: relative;
}

.ambani-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--tertiary-color);
    background-color: var(--light-color);
    padding: 5px;
}

.speech-bubble {
    position: absolute;
    background-color: var(--light-color);
    border: 3px solid var(--dark-color);
    border-radius: 15px;
    padding: 8px;
    min-width: 180px;
    top: -50px;
    left: -180px;
    z-index: 2;
    transform-origin: bottom right;
    animation: pop 0.3s ease-out;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px;
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: var(--dark-color) transparent transparent transparent;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 22px;
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: var(--light-color) transparent transparent transparent;
    z-index: 1;
}

@keyframes pop {
    0% { transform: scale(0); }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.hidden {
    display: none;
}

.money-counter {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--secondary-color);
    text-shadow: 2px 2px 0 var(--dark-color);
}

.rupee-symbol {
    color: var(--primary-color);
    margin-right: 5px;
}

/* Main Content */
main {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    padding-bottom: 60px; /* Add space for footer */
}

.items-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
    padding: 15px 0;
}

.item-card {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 5px solid var(--primary-color);
    position: relative;
    will-change: transform;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

.item-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    background-color: var(--light-color);
}

.item-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent !important;
    transition: transform 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.item-card:hover::before {
    transform: scale(1.02);
}

.item-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 5px dashed var(--tertiary-color);
    position: relative;
    z-index: 0;
}

.item-details {
    padding: 12px;
    text-align: center;
    position: relative;
    z-index: 0;
}

.item-name {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.item-price {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 1.3rem;
    color: var(--tertiary-color);
    margin-bottom: 15px;
}

/* Improved item controls layout */
.item-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: rgba(255, 215, 0, 0.1);
    padding: 10px;
    border-radius: 10px;
    border: 2px dashed var(--tertiary-color);
    position: relative;
    z-index: 2;
    gap: 8px;
}

.control-row {
    width: 100%;
    display: flex;
    justify-content: center;
}

.quantity-row {
    margin-bottom: 5px;
}

.buttons-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.buy-buttons-group, .sell-buttons-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.quantity {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: var(--dark-color);
    background-color: rgba(255, 255, 255, 0.7);
    padding: 5px 15px;
    border-radius: 10px;
    border: 2px solid var(--tertiary-color);
}

.control-button {
    background-color: var(--tertiary-color);
    color: var(--light-color);
    border: none;
    border-radius: 10px;
    padding: 8px 10px;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
    border: 2px solid var(--dark-color);
    white-space: nowrap;
    text-align: center;
    width: 100%;
}

.buy-button {
    background-color: #4CAF50;
}

.buy-max-button {
    background-color: #FF9800;
}

.sell-button {
    background-color: #F44336;
}

.sell-all-button {
    background-color: #E91E63;
}

.control-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

.control-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.control-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Receipt Styles */
.receipt-paper {
    background-color: var(--light-color);
    border-radius: 10px;
    padding: 20px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
    margin-bottom: 20px;
}

.receipt-paper::before, .receipt-paper::after {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    background-color: var(--tertiary-color);
    border-radius: 50%;
}

.receipt-paper::before {
    top: -10px;
    left: -10px;
}

.receipt-paper::after {
    top: -10px;
    right: -10px;
}

.receipt-header {
    text-align: center;
    border-bottom: 2px dashed var(--tertiary-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.receipt-header h3 {
    font-family: 'Bubblegum Sans', cursive;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

#receipt-items {
    list-style-type: none;
    margin-bottom: 15px;
    max-height: 50vh;
    overflow-y: auto;
}

#receipt-items li {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px dotted var(--tertiary-color);
}

.receipt-total {
    text-align: right;
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    color: var(--secondary-color);
    border-top: 2px dashed var(--tertiary-color);
    padding-top: 10px;
}

/* Footer Styles */
footer {
    padding: 20px;
    text-align: center;
    background-color: var(--dark-color);
    color: var(--light-color);
    font-family: 'Comic Neue', cursive;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.footer-content p {
    font-size: 1rem;
    margin: 0;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    color: var(--light-color);
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.social-links a:hover {
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* Responsive Styles */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .money-counter {
        font-size: 1.6rem;
    }
    
    .items-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 10px;
    }
    
    .cart-sidebar {
        width: 300px;
        right: -300px;
    }
    
    .cart-button {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .item-card {
        margin-bottom: 0;
    }

    .item-controls {
        padding: 8px;
    }
    
    .control-button {
        padding: 6px 10px;
        font-size: 0.9rem;
    }

    .item-image {
        height: 150px;
    }

    .item-name {
        font-size: 1.2rem;
    }

    .item-price {
        font-size: 1.1rem;
    }

    .buttons-row {
        flex-direction: column;
        gap: 5px;
    }
    
    .buy-buttons-group, .sell-buttons-group {
        flex-direction: row;
        width: 100%;
    }
    
    .quantity {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .logo-img {
        width: 35px;
        height: 35px;
    }
    
    h1 {
        font-size: 1.4rem;
    }
    
    .money-counter {
        font-size: 1.3rem;
    }
    
    .ambani-avatar img {
        width: 50px;
        height: 50px;
    }
    
    .speech-bubble {
        position: fixed;
        min-width: auto;
        width: auto;
        max-width: 80%;
        left: auto;
        right: 10px;
        top: auto;
        bottom: 70px;
        font-size: 0.9rem;
        padding: 8px 12px;
        margin: 0;
        z-index: 99;
    }
    
    .speech-bubble::after {
        bottom: -10px;
        right: 20px;
        border-width: 10px 10px 0;
    }

    .speech-bubble::before {
        bottom: -6px;
        right: 22px;
        border-width: 8px 8px 0;
    }

    #speech-text {
        word-break: break-word;
        white-space: normal;
    }
    
    .items-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 8px;
    }
    
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 10px;
    }

    .item-card {
        border-width: 3px;
    }

    .item-image {
        height: 120px;
    }

    .item-name {
        font-size: 1.1rem;
    }

    .item-price {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .item-controls {
        padding: 6px;
        gap: 5px;
    }
    
    .control-button {
        padding: 5px 8px;
        font-size: 0.8rem;
    }
    
    .quantity {
        font-size: 1.2rem;
        padding: 3px 10px;
    }

    .buttons-row {
        flex-direction: column;
        gap: 5px;
    }
    
    .buy-buttons-group, .sell-buttons-group {
        flex-direction: row;
        width: 100%;
    }

    .ambani-avatar {
        position: static;
    }
}

/* Fix touch scrolling issues */
.touch-active {
    pointer-events: none;
}

main {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    padding-bottom: 60px; /* Add space for footer */
}

.cart-sidebar {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
} 