body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    padding: 0;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    flex-direction: column;
    background: linear-gradient(135deg, #f5f7fa, #e4e9f0);
}

.mobile-container {
    width: 90%;
    max-width: 350px;
    background-color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.09);
    padding: 25px;
    margin: 20px auto;
    border: 1px solid #e0e0e0;
}

.side-title {
    text-align: center;
    margin-bottom: 10px;
}

.app-title {
    font-size: 3.5em;
    font-weight: 800;
    margin: 0;
    letter-spacing: 2px;
    color: #212121;
    animation: popUp 1.5s ease-out forwards;
}

.iq-title {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    transition: color 3s ease;
    font-size: 1em; /* Adjusted to fit within title */
    font-weight: 500;
    animation: iqColorChange 5s linear infinite;
}

@keyframes iqColorChange {
    0% { color: #3498db; }
    20% { color: #e74c3c; }
    40% { color: #2ecc71; }
    60% { color: #f39c12; }
    80% { color: #9b59b6; }
    100% { color: #3498db; }
}

.progress-container {
    margin-bottom: 20px;
}

progress {
    width: 100%;
    height: 20px;
    border-radius: 7px;
    border: none;
    background-color: #f0f0f0;
}

progress::-webkit-progress-value {
    border-radius: 7px;
    transition: width 0.4s ease;
}

progress::-webkit-progress-bar {
    background-color: transparent;
}

.progress-container.green progress::-webkit-progress-value {
    background: linear-gradient(to right, #42f56f, #64f67a);
}

.progress-container.yellow progress::-webkit-progress-value {
    background: linear-gradient(to right, #ffeb3b, #ffc107);
}

.progress-container.orange progress::-webkit-progress-value {
    background: linear-gradient(to right, #ff9800, #f57c00);
}

.progress-container.red progress::-webkit-progress-value {
    background: linear-gradient(to right, #e57373, #f44336);
}

.progress-text {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.85em;
    color: #757575;
}

#video-container {
    position: relative;
    width: 100%;
    height: 150px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    border-radius: 10px;
}

#result {
    font-size: 1em;
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    background-color: #f9f9f9;
    text-align: center;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#result.scanning {
    opacity: 0.7;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.scanner-controls {
    display: flex;
    justify-content: center;
    margin-top: 15px;
}

button {
    padding: 8px 16px;
    margin: 5px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9em;
    background-color: white;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    background-color: #f8f8f8;
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cart-title {
    margin-bottom: 15px;
    color: #212121;
    font-weight: 500;
    font-size: 1.1em;
    text-align: center;
}

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

.product-count {
    font-size: 0.9em;
    color: #757575;
}

.search-container {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 5px;
    overflow: hidden;
}

.search-container input[type="text"] {
    border: none;
    padding: 8px 10px;
    flex-grow: 1;
    outline: none;
}

.search-container button {
    background-color: transparent;
    border: none;
    padding: 8px 10px;
    cursor: pointer;
}

.search-container img {
    height: 17px;
    width: 17px;
    vertical-align: middle;
}

.cart-container {
    border-radius: 12px;
    padding: 20px;
    max-height: 200px;
    background-color: #f9f9f9;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.07);
}

#scanned-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

#scanned-items li {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
}

#scanned-items li.hidden {
    display: none;
}

.cart-item-content {
    display: flex;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
}

.product-name {
    font-weight: bold;
    margin-right: 10px;
    flex-grow: 1;
    min-width: 100px;
    word-break: break-word;
    width: 100%;
}

.quantity-controls {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.quantity-controls button {
    padding: 5px 10px;
    margin: 0 5px;
}

.price {
    margin-left: 10px;
    margin-right: 10px;
}

.delete-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    color: #d9534f;
    padding: 5px;
    margin-left: auto;
}

.delete-button i {
    vertical-align: middle;
}

.checkout-container {
    text-align: center;
    margin-top: 15px;
}

#checkout-btn {
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1em;
}

#checkout-btn:hover {
    background-color: #45a049;
}

/* Logout Button */
#logout-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: transparent;
    border: none;
    color: red;
    font-size: 1em;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.8;
}

#logout-btn:hover {
    transform: scale(1.1);
    opacity: 1;
}

/* Greeting */
.greeting {
    text-align: center;
    margin: 10px 0;
    font-size: 1.2em;
    color: #333;
}

/* Checkout Page */
.checkout-page {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: #ffffff;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.09);
    width: 90%;
    max-width: 350px;
    z-index: 1000;
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.checkout-page.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.checkout-page h2 {
    margin: 0 0 20px;
    font-size: 1.2em;
    color: #212121;
    font-weight: 500;
    text-align: center;
}

#checkout-cart-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    max-height: 200px;
    overflow-y: auto;
    background-color: #f9f9f9;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.07);
}

#checkout-cart-list li {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    color: #555;
    font-size: 0.9em;
}

#checkout-total {
    font-size: 1.1em;
    font-weight: 600;
    text-align: right;
    margin-bottom: 20px;
    padding: 10px;
    background: linear-gradient(45deg, #4caf50, #66bb6a);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#proceed-checkout, .close-checkout {
    padding: 10px 20px;
    font-size: 0.9em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#proceed-checkout {
    background: linear-gradient(45deg, #4caf50, #66bb6a);
    color: white;
    margin-right: 10px;
}

#proceed-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.close-checkout {
    background: linear-gradient(45deg, #f44336, #ef5350);
    color: white;
}

.close-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Media query for smaller screens */
@media (max-width: 600px) {
    #scanned-items li {
        flex-direction: column;
        align-items: flex-start;
    }

    .cart-item-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .product-name {
        width: 100%;
        margin-bottom: 5px;
    }

    .quantity-controls,
    .price,
    .delete-button {
        width: auto;
        margin: 0;
    }

    .quantity-controls {
        margin-right: 10px;
    }

    .delete-button {
        margin-left: auto;
    }

    .cart-item-content > div:last-child {
        display: flex;
        align-items: center;
        width: 100%;
        justify-content: flex-start;
        margin-top: 5px;
    }
}
