/* 
 * Loei Rice E-commerce Style
 * Main CSS file for the rice e-commerce website
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: #fafafa;
}

/* Header */
.header {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #f0f0f0;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: #2d5016;
}

.logo-icon {
    font-size: 2rem;
}

.nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: #666;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: #27ae60;
}

.nav-link.active {
    color: #27ae60;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: #27ae60;
    border-radius: 1px;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification-btn,
.cart-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.notification-btn:hover,
.cart-btn:hover {
    background: #f5f5f5;
    color: #27ae60;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 12px;
    transition: background 0.3s ease;
    position: relative;
}

.user-profile:hover {
    background: #f5f5f5;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #27ae60, #2d5016);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
}

.user-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

.user-welcome {
    font-size: 0.75rem;
    color: #666;
}

.user-dropdown-menu a:hover {
    background: #f8f9fa !important;
}

/* Search Bar */
.search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

.search-bar {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    outline: none;
    border-color: #27ae60;
    box-shadow: 0 2px 12px rgba(39, 174, 96, 0.15);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 1.2rem;
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #27ae60;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.search-btn:hover {
    background: #219a52;
}

/* Hero Cover Section */
.hero-cover {
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 0 1.5rem;
    position: relative;
}

.hero-image {
    position: relative;
    height: 400px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
            rgba(45, 80, 22, 0.8) 0%,
            rgba(39, 174, 96, 0.6) 50%,
            rgba(45, 80, 22, 0.8) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-content p {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-btn {
    padding: 1rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.hero-btn.primary {
    background: white;
    color: #27ae60;
}

.hero-btn.primary:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.hero-btn.secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.hero-btn.secondary:hover {
    background: white;
    color: #27ae60;
    transform: translateY(-2px);
}

/* Sections */
.section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.see-all-btn {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.see-all-btn:hover {
    color: #2980b9;
}

/* Categories */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 3rem;
}

.category-item {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.category-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #e0e0e0;
}

.category-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.category-item:hover .category-icon {
    background: #27ae60;
    color: white;
}

.category-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.3rem;
}

.category-count {
    font-size: 0.8rem;
    color: #666;
}

/* Hot Deals Section */
.hot-deals {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    margin: 3rem 0;
    border: 1px solid #f0f0f0;
}

.deals-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.deals-icon {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.deals-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
}

/* Filter Pills */
.filter-pills {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.filter-pill {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e0e0e0;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.filter-pill:hover,
.filter-pill.active {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
}

.filter-pill .count {
    font-size: 0.85em;
    opacity: 0.8;
    margin-left: 0.3rem;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
    border-color: #e0e0e0;
}

.product-image {
    position: relative;
    height: 200px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #ccc;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-badges {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-badge {
    background: #e74c3c;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.product-badge.discount {
    background: #e74c3c;
}

.product-badge.featured {
    background: #f39c12;
}

.favorite-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.favorite-btn:hover {
    background: white;
    color: #e74c3c;
    transform: scale(1.1);
}

.favorite-btn.active {
    color: #e74c3c;
    background: white;
}

.product-content {
    padding: 1.5rem;
}

.product-category {
    color: #999;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.8rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.price-current {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.price-original {
    font-size: 1rem;
    color: #999;
    text-decoration: line-through;
}

.product-actions {
    display: flex;
    gap: 0.8rem;
}

.btn-add-cart {
    flex: 1;
    background: #27ae60;
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-add-cart:hover {
    background: #219a52;
    transform: translateY(-1px);
}

.btn-view {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e0e0e0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-view:hover {
    background: #e9ecef;
    color: #333;
    border-color: #ccc;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Fade Animation */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #f0f0f0;
    padding: 0.5rem 0;
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #999;
    padding: 0.5rem;
    transition: color 0.3s ease;
    flex: 1;
    max-width: 80px;
}

.nav-item.active {
    color: #27ae60;
}

.nav-icon {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 500;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header-container {
        padding: 1rem;
    }

    .nav {
        display: none;
    }

    .hero-image {
        height: 300px;
        border-radius: 15px;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1.1rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hero-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    .section {
        padding: 0 1rem 2rem;
    }

    .search-container {
        padding: 1rem;
    }

    .user-info {
        display: none;
    }

    .bottom-nav {
        display: flex;
    }
    
    body {
        padding-bottom: 70px;
    }
}

@media (max-width: 480px) {
    .hero-image {
        height: 250px;
        border-radius: 12px;
    }

    .hero-content h1 {
        font-size: 1.6rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-view {
        width: 100%;
        height: 44px;
    }
}