/* Sweets E-Commerce Module - Modern Mobile-First Design */

:root {
    --primary-color: #003366;
    --primary-gradient: linear-gradient(135deg, #003366 0%, #004080 100%);
    --secondary-color: #DC143C;
    --accent-color: #FFD700;
    --accent-gradient: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    --text-dark: #2C2C2C;
    --text-light: #666;
    --text-lighter: #999;
    --bg-light: #F8F9FE;
    --bg-gradient: linear-gradient(180deg, #F8F9FE 0%, #FFFFFF 100%);
    --border-color: #E0E6ED;
    --shadow-sm: 0 2px 8px rgba(0, 51, 102, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 51, 102, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 51, 102, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Noto Sans Tamil', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Product Grid - Mobile First */
.products-container {
    padding: 2px;
    max-width: 1400px;
    margin: 0 auto;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    margin-top: 4px;
}

@media (min-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .products-container {
        padding: 8px;
    }
}

@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 12px;
    }
    
    .products-container {
        padding: 15px 10px;
    }
}

.product-card {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 51, 102, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    border: 1px solid #f8f8f8;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 0;
}

.product-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 51, 102, 0.08);
}

.product-card:active {
    transform: translateY(0);
}

@media (min-width: 1024px) {
    .product-card {
        border-radius: var(--radius-md);
    }
    
    .product-card:hover {
        transform: translateY(-5px) scale(1.01);
        box-shadow: var(--shadow-md);
    }
    
    .product-card:active {
        transform: translateY(-2px) scale(1.0);
    }
}

.product-image-container {
    position: relative;
    width: 100%;
    height: 100px;
    overflow: hidden;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--bg-gradient);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.product-name-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0, 51, 102, 0.8), rgba(220, 20, 60, 0.8));
    color: white;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    padding: 4px;
    line-height: 1.1;
    z-index: 2;
}

@media (min-width: 640px) {
    .product-image-container {
        height: 140px;
    }
    .product-name-overlay {
        font-size: 1.2rem;
        padding: 8px;
    }
}

@media (min-width: 1024px) {
    .product-image-container {
        height: 200px;
    }
    .product-name-overlay {
        font-size: 1.8rem;
        padding: 10px;
        line-height: 1.2;
    }
}

.product-info {
    padding: 2px 4px;
    position: relative;
    z-index: 1;
}

@media (min-width: 640px) {
    .product-info {
        padding: 6px 8px;
    }
}

@media (min-width: 1024px) {
    .product-info {
        padding: 10px;
    }
}

.product-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1px;
    letter-spacing: -0.01em;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 26px;
}

@media (min-width: 640px) {
    .product-name {
        font-size: 12px;
        margin-bottom: 3px;
        min-height: 30px;
    }
}

@media (min-width: 1024px) {
    .product-name {
        font-size: 15px;
        margin-bottom: 5px;
        font-weight: 700;
        letter-spacing: -0.02em;
        line-height: 1.3;
        min-height: auto;
    }
}

.product-description {
    font-size: 9px;
    color: var(--text-light);
    margin-bottom: 2px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (min-width: 640px) {
    .product-description {
        font-size: 10px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        margin-bottom: 4px;
        line-height: 1.3;
    }
}

@media (min-width: 1024px) {
    .product-description {
        font-size: 12px;
        margin-bottom: 6px;
        line-height: 1.4;
    }
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
    flex-wrap: wrap;
    gap: 2px;
}

@media (min-width: 1024px) {
    .product-meta {
        margin-bottom: 8px;
        gap: 5px;
    }
}

.product-price {
    font-size: 13px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

@media (min-width: 640px) {
    .product-price {
        font-size: 15px;
    }
}

@media (min-width: 1024px) {
    .product-price {
        font-size: 20px;
        font-weight: 800;
        letter-spacing: -0.03em;
    }
}

.product-weight {
    font-size: 8px;
    color: var(--text-lighter);
    background: var(--bg-light);
    padding: 1px 5px;
    border-radius: 6px;
    font-weight: 500;
    border: 1px solid rgba(0, 51, 102, 0.05);
}

@media (min-width: 640px) {
    .product-weight {
        font-size: 9px;
        padding: 2px 7px;
        border-radius: 8px;
    }
}

@media (min-width: 1024px) {
    .product-weight {
        font-size: 11px;
        padding: 3px 9px;
        border-radius: 16px;
        font-weight: 600;
        border: 1px solid rgba(0, 51, 102, 0.1);
    }
}

.add-to-cart-btn {
    width: 100%;
    padding: 5px 3px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.1px;
    box-shadow: 0 1px 3px rgba(0, 51, 102, 0.1);
    position: relative;
    overflow: hidden;
}

@media (min-width: 640px) {
    .add-to-cart-btn {
        font-size: 11px;
        padding: 7px 5px;
        border-radius: 5px;
        letter-spacing: 0.2px;
    }
}

@media (min-width: 1024px) {
    .add-to-cart-btn {
        font-size: 13px;
        padding: 10px;
        border-radius: var(--radius-md);
        font-weight: 700;
        letter-spacing: 0.3px;
        box-shadow: 0 3px 8px rgba(0, 51, 102, 0.2);
    }
}

.add-to-cart-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.add-to-cart-btn:active::before {
    width: 300px;
    height: 300px;
}

.add-to-cart-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 51, 102, 0.2);
}

.add-to-cart-btn:active {
    transform: translateY(0);
}

@media (min-width: 1024px) {
    .add-to-cart-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(0, 51, 102, 0.3);
    }
}

.add-to-cart-btn:disabled {
    background: linear-gradient(135deg, #ccc 0%, #999 100%);
    cursor: not-allowed;
    box-shadow: none;
}

/* Category Filter */
.category-filter {
    margin: 8px 0;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.category-btn {
    padding: 5px 10px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

.category-btn:hover,
.category-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

@media (min-width: 640px) {
    .category-filter {
        margin: 12px 0;
        gap: 6px;
    }
    
    .category-btn {
        padding: 6px 14px;
        font-size: 12px;
    }
}

@media (min-width: 1024px) {
    .category-filter {
        margin: 18px 0;
        gap: 8px;
        overflow-x: visible;
    }
    
    .category-btn {
        padding: 7px 18px;
        border: 2px solid var(--border-color);
        border-radius: 22px;
        font-size: 13px;
    }
}

/* Search Bar */
.search-container {
    margin: 8px 0;
}

.search-input {
    width: 100%;
    max-width: 500px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    font-size: 13px;
}

@media (min-width: 640px) {
    .search-container {
        margin: 12px 0;
    }
    
    .search-input {
        padding: 8px 16px;
        font-size: 14px;
    }
}

@media (min-width: 1024px) {
    .search-container {
        margin: 18px 0;
    }
    
    .search-input {
        padding: 10px 18px;
        border: 2px solid var(--border-color);
        border-radius: 22px;
        font-size: 15px;
    }
}

/* Cart Page */
.cart-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 8px;
}

.cart-items {
    background: white;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
}

.cart-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--bg-light);
}

.cart-item-details {
    flex: 1;
}

.cart-item-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 3px;
}

.cart-item-price {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 600;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 3px;
}

.quantity-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.quantity-input {
    width: 35px;
    text-align: center;
    border: none;
    font-size: 14px;
    font-weight: 600;
}

.remove-btn {
    padding: 6px 10px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.remove-btn:hover {
    background: #B91C3C;
}

.cart-summary {
    background: white;
    border-radius: 8px;
    padding: 20px;
    position: sticky;
    top: 15px;
}

.cart-summary h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--text-dark);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
}

.summary-row.total {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.checkout-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
}

.checkout-btn:hover {
    background: #004080;
}

/* Checkout Form */
.checkout-form {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.form-required {
    color: var(--secondary-color);
}

/* Shopping Cart Badge */
.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.cart-icon-wrapper {
    position: relative;
    display: inline-block;
}

/* Empty Cart Message */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart-icon {
    font-size: 80px;
    color: var(--border-color);
    margin-bottom: 20px;
}

.empty-cart h3 {
    font-size: 24px;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.empty-cart p {
    color: var(--text-light);
    margin-bottom: 25px;
}

.continue-shopping-btn {
    padding: 12px 30px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    display: inline-block;
    font-weight: 600;
}

/* Success/Error Messages */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #FCE8E8;
    color: var(--secondary-color);
    border: 1px solid #F5C2C7;
}

/* Responsive */
@media (max-width: 768px) {
    .cart-item {
        flex-direction: column;
    }
    
    .cart-item-image {
        width: 100%;
        height: 200px;
    }
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
