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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

/* Top Header */
.top-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 2rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
}

.logo:hover {
    opacity: 0.9;
}

/* User Navigation */
.user-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-weight: 500;
}

#user-greeting {
    color: #e2e8f0;
    font-size: 0.9rem;
}

#auth-links, #user-links {
    display: flex;
    gap: 1rem;
}

#auth-links a, #user-links a {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    transition: all 0.3s;
}

#auth-links a:hover, #user-links a:hover {
    background: rgba(255,255,255,0.2);
}

#logout-link {
    background: rgba(255,100,100,0.2) !important;
}

#logout-link:hover {
    background: rgba(255,100,100,0.4) !important;
}

/* Auth Pages */
.auth-container {
    max-width: 400px;
    margin: 4rem auto;
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.auth-container h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    color: #4a5568;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.error-message {
    color: #e53e3e;
    background: #fff5f5;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    display: none;
}

/* Horizontal Category Navigation */
.header-container nav { display: flex; align-items: center; gap: 1rem; }
.category-scroll { max-width: 100%; overflow-x: auto; }
.category-nav {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    flex-wrap: nowrap;
    padding: 0.25rem 0;
}

.category-nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s;
    font-weight: 500;
}

.category-nav a:hover,
.category-nav a.active {
    background-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

/* Category Dropdown in Header */
.nav-select {
    border: none;
    background: transparent;
    color: white;
    font-weight: bold;
    font-size: 1.6rem;
    cursor: pointer;
    appearance: menulist;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    height: auto;
    padding: 0;
    min-width: 0;
}
.nav-select:focus {
    outline: none;
}
.nav-select:hover {
    background-color: transparent;
    transform: none;
}
.category-home-link {
    color: white;
    text-decoration: none;
    border-radius: 20px;
    transition: all 0.3s;
    font-weight: 500;
    background-color: rgba(255,255,255,0.2);
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 16px;
}
.category-home-link:hover {
    background-color: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}
/* Shopping Cart Widget (Bottom Right, Icon Style, Hover) */
.cart-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.cart-widget-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s;
    position: relative;
    border: 3px solid white;
}

.cart-widget-header:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.cart-widget-icon {
    font-size: 1.8rem;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    border: 2px solid white;
}

/* Shopping Cart Content (Hover to show, expands upward) */
.cart-widget-content {
    background: white;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
    width: 350px;
    margin-bottom: 10px;
    transform-origin: bottom;
}

.cart-widget-container:hover .cart-widget-content {
    max-height: 600px;
    opacity: 1;
    padding: 1.5rem;
}

.cart-widget-title {
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eee;
    color: #2c3e50;
    font-size: 1rem;
}

.cart-widget-items {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.cart-widget-item {
    padding: 0.8rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.cart-widget-item:last-child {
    border-bottom: none;
}

.cart-widget-item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-widget-item-details {
    color: #666;
    font-size: 0.85rem;
    flex: 1;
}

.cart-widget-item-remove {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 50%;
    transition: background 0.3s;
    margin-left: 0.5rem;
}

.cart-widget-item-remove:hover {
    background: #fee;
}

.cart-widget-summary {
    padding-top: 1rem;
    border-top: 2px solid #eee;
    margin-top: 1rem;
}

.cart-widget-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.cart-widget-summary-row.total {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2c3e50;
    padding-top: 0.5rem;
    border-top: 1px solid #ddd;
    margin-top: 0.5rem;
}

.cart-widget-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #eee;
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Breadcrumb Navigation */
.breadcrumb {
    background: white;
    padding: 1rem 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-size: 0.95rem;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: #7f8c8d;
}

/* Hero Section */
.hero {
    background: white;
    padding: 4rem 2rem;
    text-align: center;
    border-radius: 15px;
    margin-bottom: 3rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content p {
    font-size: 1.3rem;
    color: #7f8c8d;
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-block {
    display: block;
    width: 100%;
    margin-top: 1rem;
}

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

/* Product Card - Modern Design */
.product-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
}

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

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.product-card:hover::before {
    opacity: 1;
}

.product-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.product-card:hover img {
    transform: scale(1.05);
}

.product-card-content {
    padding: 1.5rem;
}

.product-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.product-card .category {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.product-card .price {
    font-size: 1.8rem;
    font-weight: bold;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.product-card .btn {
    width: 100%;
    padding: 0.8rem;
    font-size: 0.95rem;
    border-radius: 10px;
}

/* Featured Products Section */
.featured-products {
    background: white;
    padding: 3rem 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.featured-products h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Products Section */
.products-section {
    background: white;
    padding: 3rem 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.products-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #2c3e50;
}

.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-bar input {
    flex: 1;
    min-width: 250px;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.filter-bar input:focus {
    outline: none;
    border-color: #667eea;
}

/* Product Detail */
.product-detail-section {
    background: white;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.product-detail-image {
    width: 100%;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.product-detail-info h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.product-detail-info .category {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.product-detail-info .price {
    font-size: 2.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
}

.product-detail-info .description {
    margin-bottom: 2rem;
    line-height: 1.8;
    color: #555;
    font-size: 1.1rem;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.quantity-selector label {
    font-weight: 600;
    color: #2c3e50;
}

.quantity-selector input {
    width: 100px;
    padding: 0.8rem;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1.1rem;
    transition: border-color 0.3s;
}

.quantity-selector input:focus {
    outline: none;
    border-color: #667eea;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .cart-panel {
        width: 350px;
    }

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

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }

    .category-nav {
        justify-content: center;
    }

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

    .product-detail {
        grid-template-columns: 1fr;
    }

    .cart-widget-container {
        bottom: 20px;
        right: 20px;
    }

    .cart-widget-header {
        width: 55px;
        height: 55px;
    }

    .cart-widget-content {
        width: 300px;
    }

    .main-container {
        padding: 1rem;
    }

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

/* Empty cart message */
.empty-cart-message {
    text-align: center;
    padding: 2rem 1rem;
    color: #7f8c8d;
}

.empty-cart-message h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-size: 1rem;
}

.empty-cart-message p {
    font-size: 0.85rem;
}
