/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #0f3460;
    --danger-color: #e94560;
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    --light-color: #f5f5f5;
    --dark-color: #333;
    --gray-color: #666;
    --light-gray: #eee;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f9f9f9;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--danger-color);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--light-gray);
    color: var(--dark-color);
}

.btn-secondary:hover {
    background-color: #ddd;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #d32f2f;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #388e3c;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(15, 52, 96, 0.1);
}

.form-control.error {
    border-color: var(--danger-color);
}

.error-message {
    color: var(--danger-color);
    font-size: 12px;
    margin-top: 5px;
}

/* Header & Navigation */
.header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--box-shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.logo span {
    color: var(--danger-color);
}

.nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: white;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--danger-color);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.cart-icon {
    position: relative;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* Hero Section */
.hero {
    background: linear-gradient(rgba(26,26,46,0.9), rgba(26,26,46,0.9)), url('https://images.unsplash.com/photo-1589519160732-57fc498494f8?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Category Grid (For categories and brands) - FIXED FOR ROWS */
.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 2rem 0;
}

.category-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.category-image {
    height: 150px;
    overflow: hidden;
    flex-shrink: 0;
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.category-card:hover .category-image img {
    transform: scale(1.1);
}

.category-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.view-all {
    color: var(--accent-color);
    font-weight: 500;
    white-space: nowrap;
}

.view-all:hover {
    color: var(--danger-color);
}

/* Age Warning */
.age-warning {
    background-color: #fff3cd;
    border-left: 4px solid var(--warning-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: var(--border-radius);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 2rem 0;
}

.product-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.product-image {
    height: 200px;
    overflow: hidden;
    position: relative;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--danger-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.product-info {
    padding: 1.5rem;
}

.product-title {
    font-size: 16px;
    margin-bottom: 0.5rem;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price {
    color: var(--accent-color);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.product-vat {
    color: var(--gray-color);
    font-size: 12px;
    margin-bottom: 1rem;
}

.product-stock {
    font-size: 12px;
    color: var(--success-color);
    margin-bottom: 1rem;
}

.product-stock.out-of-stock {
    color: var(--danger-color);
}

/* Filters */
.filters-section {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.price-range {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.price-range input {
    flex: 1;
}

/* Cart */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.cart-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: left;
}

.cart-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--light-gray);
}

.cart-table img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.cart-summary {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 2rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--light-gray);
}

.summary-row.total {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-color);
    border-bottom: none;
}

/* Checkout */
.checkout-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.checkout-form {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.checkout-summary {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

/* Profile */
.profile-section {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.profile-sidebar {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    height: fit-content;
}

.profile-nav {
    list-style: none;
}

.profile-nav li {
    margin-bottom: 0.5rem;
}

.profile-nav a {
    display: block;
    padding: 12px;
    border-radius: var(--border-radius);
    color: var(--dark-color);
}

.profile-nav a:hover,
.profile-nav a.active {
    background-color: var(--light-gray);
    color: var(--accent-color);
}

.profile-content {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 18px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #ddd;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #aaa;
    font-size: 14px;
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light-gray);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-color);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 1rem;
    color: #ddd;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.toast {
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

/* Responsive Design */

/* Tablet (768px to 1024px) */
@media (max-width: 1024px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .checkout-section {
        grid-template-columns: 1.5fr 1fr;
    }
    
    .profile-section {
        grid-template-columns: 250px 1fr;
    }
}

/* Mobile (up to 768px) */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .nav {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 1rem;
        margin-top: 1rem;
        padding: 1rem 0;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    
    .nav.show {
        display: flex;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .checkout-section {
        grid-template-columns: 1fr;
    }
    
    .profile-section {
        grid-template-columns: 1fr;
    }
    
    .hero {
        padding: 2.5rem 0;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .cart-table {
        display: block;
        overflow-x: auto;
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .view-all {
        align-self: flex-end;
    }
    
    .category-image {
        height: 120px;
    }
    
    .category-info {
        padding: 1rem;
    }
}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    .category-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .category-image {
        height: 150px;
    }
    
    .toast {
        min-width: 250px;
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
}

/* Extra Small Devices (up to 360px) */
@media (max-width: 360px) {
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .category-info h3 {
        font-size: 1rem;
    }
    
    .product-title {
        font-size: 14px;
        height: 36px;
    }
    
    .product-price {
        font-size: 18px;
    }
}

/* Landscape Mode */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 2rem 0;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* High-resolution screens */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .category-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
    
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}

/* Print styles */
@media print {
    .header, .footer, .mobile-menu-btn, .btn {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
}

.wishlist-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: all 0.3s;
}

.wishlist-btn:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
}

.wishlist-btn.active {
    background: var(--danger-color);
    color: white;
}

.wishlist-btn i {
    font-size: 16px;
}

/* Wishlist icon in navbar */
.wishlist-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.wishlist-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Remove wishlist button */
.remove-wishlist-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: all 0.3s;
}

.remove-wishlist-btn:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
}

.remove-wishlist-btn i {
    font-size: 16px;
}

/* Wishlist page specific */
.wishlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

@media (max-width: 480px) {
    .wishlist-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

