* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    padding: 20px;
    padding-top: 100px;
    padding-bottom: 100px;
    color: #333;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
    font-weight: 600;
    padding: 10px;
    position: relative;
}

h1:after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: #3498db;
    margin: 10px auto;
    border-radius: 2px;
}

/* User Info and Actions Styling */
.user-info {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 15px;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 120px;
}

.user-info i {
    font-size: 24px;
    color: #4a6fa5;
    margin-right: 10px;
}

.username {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.user-actions {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
}

.login-btn, .logout-btn {
    background: #4a6fa5;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: background 0.3s;
    font-size: 14px;
}

.login-btn:hover, .logout-btn:hover {
    background: #3a5a80;
}

.cart-icon {
    position: fixed;
    top: 150px;
    right: 20px;
    background: #4a6fa5;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.cart-icon i {
    font-size: 20px;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.payment-btn {
    position: fixed;
    top: 220px;
    right: 20px;
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    z-index: 1000;
    transition: background 0.3s;
    font-size: 14px;
}

.payment-btn:hover {
    background: #219653;
}

/* Product Grid Styling - 2 products per row */
.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid #eee;
}

.card-body {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-body h3 {
    margin: 0 0 10px;
    font-size: 16px;
    color: #2c3e50;
    font-weight: 600;
    line-height: 1.3;
}

.card-body p {
    font-size: 13px;
    color: #7f8c8d;
    margin-bottom: 15px;
    line-height: 1.4;
    flex-grow: 1;
}

.price-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.price {
    font-weight: bold;
    color: #3498db;
    font-size: 18px;
}

.original-price {
    text-decoration: line-through;
    color: #95a5a6;
    font-size: 14px;
    margin-right: 5px;
}

.discount {
    font-size: 12px;
    color: #fff;
    background: #e74c3c;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 5px;
}

.btn {
    display: inline-block;
    padding: 10px 15px;
    background: #3498db;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
    font-weight: 500;
}

.btn:hover {
    background: #2980b9;
}

.btn-add-cart {
    background: #27ae60;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-cart:hover {
    background: #219653;
}

/* Cart Modal Styling */
.cart-modal {
    display: none;
    position: fixed;
    top: 80px;
    right: 20px;
    width: 350px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    max-height: 70vh;
    overflow-y: auto;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.cart-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
}

.close-cart {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f5f5f5;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.cart-item-price {
    color: #666;
    font-size: 14px;
}

.cart-item-total {
    font-weight: 600;
    margin: 0 15px;
    color: #4a6fa5;
}

.btn-remove {
    background: #e74c3c;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.empty-cart {
    text-align: center;
    padding: 30px;
    color: #999;
}

.empty-cart i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

.cart-total {
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    text-align: right;
    border-top: 2px solid #eee;
}

.checkout-btn {
    width: calc(100% - 30px);
    margin: 0 15px 15px;
    background: #27ae60;
    padding: 12px;
    border-radius: 6px;
}

.checkout-btn:hover {
    background: #219653;
}

.payment-options {
    display: none;
    padding: 15px;
    border-top: 1px solid #eee;
}

.payment-options h4 {
    margin-top: 0;
    margin-bottom: 15px;
    text-align: center;
}

.payment-btn-option {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 2px solid #4a6fa5;
    background: white;
    color: #4a6fa5;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.3s;
}

.payment-btn-option:hover {
    background: #4a6fa5;
    color: white;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.login-error {
    background: #ffe6e6;
    color: #d63031;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    border-left: 4px solid #d63031;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
}

.qr-code {
    text-align: center;
    margin: 20px 0;
}

.qr-code img {
    max-width: 100%;
    height: auto;
}

.success-icon {
    text-align: center;
    margin: 20px 0;
    color: #27ae60;
    font-size: 48px;
}

.print-btn {
    background: #34495e;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    width: 100%;
    margin-top: 15px;
}

.print-btn:hover {
    background: #2c3e50;
}

/* Bill Receipt Styling */
.bill-receipt {
    background: white;
    padding: 20px;
    max-width: 300px;
    margin: 0 auto;
    font-family: monospace;
    display: none;
}

.bill-header {
    text-align: center;
    border-bottom: 2px dashed #333;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.bill-header h2 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.bill-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.bill-total {
    text-align: right;
    font-weight: bold;
    font-size: 16px;
    margin: 15px 0;
    padding-top: 10px;
    border-top: 2px dashed #333;
}

.bill-qr {
    text-align: center;
    margin: 15px 0;
    padding: 10px;
    border: 1px dashed #ccc;
}

.bill-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #ccc;
    font-size: 12px;
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    /* Move all icons to the left side for mobile */
    .user-info {
        top: 15px;
        right: 20px;
        left: auto;
        padding: 8px 12px;
    }
    
    .user-actions {
        top: 75px;
        right: 20px;
        left: auto;
    }
    
    .cart-icon {
        top: 135px;
        right: 20px;
        left: auto;
        width: 40px;
        height: 40px;
    }
    
    .payment-btn {
        top: 195px;
        right: 20px;
        left: auto;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .cart-modal {
        width: 90%;
        right: 5%;
        left: 5%;
        top: 50%;
        transform: translateY(-50%);
    }
    
    /* Ensure 2 products per row on mobile */
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 15px;
    }
    
    .card img {
        height: 150px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    body {
        padding-top: 250px;
        padding-bottom: 80px;
    }
}

@media (min-width: 769px) {
    /* For larger screens, show more products per row */
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    /* For very small screens, adjust spacing */
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
    }
    
    .card img {
        height: 120px;
    }
    
    .card-body h3 {
        font-size: 14px;
    }
    
    .card-body p {
        font-size: 12px;
    }
    
    .price {
        font-size: 16px;
    }
}

@media print {
    body * {
        visibility: hidden;
    }
    .bill-receipt, .bill-receipt * {
        visibility: visible;
    }
    .bill-receipt {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}