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

:root {
    --primary-color: #2d3436;
    --secondary-color: #636e72;
    --accent-color: #00b894;
    --accent-hover: #00a085;
    --accent-light: #e8f8f5;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-light: #b2bec3;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #dfe6e9;
    --success-color: #00b894;
    --link-color: #0984e3;
    --warning-color: #fdcb6e;
    --font-primary: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-size-base: 15px;
    --line-height-base: 1.6;
    --header-height: 70px;
    --container-max: 1400px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

html {
    font-size: var(--font-size-base);
}

body {
    font-family: var(--font-primary);
    color: var(--text-primary);
    line-height: var(--line-height-base);
    background-color: var(--bg-light);
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
}

ul {
    list-style: none;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

.header {
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.header-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-size: 22px;
    font-weight: 700;
    text-decoration: none;
    flex-shrink: 0;
}

.logo:hover {
    text-decoration: none;
}

.logo-icon {
    font-size: 26px;
    color: var(--accent-color);
}

.search-bar {
    flex: 1;
    display: flex;
    max-width: 600px;
}

.search-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--border-color);
    border-right: none;
    border-radius: 8px 0 0 8px;
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.search-input:focus {
    border-color: var(--accent-color);
}

.search-btn {
    padding: 12px 20px;
    background-color: var(--accent-color);
    border-radius: 0 8px 8px 0;
    color: white;
    transition: background-color var(--transition-fast);
}

.search-btn:hover {
    background-color: var(--accent-hover);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    background-color: var(--accent-light);
    color: var(--accent-color);
    text-decoration: none;
}

.cart-wrapper {
    position: relative;
}

.cart-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    padding: 10px 14px;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.cart-btn:hover {
    background-color: var(--accent-light);
    color: var(--accent-color);
}

.cart-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-color);
    background: var(--accent-light);
    padding: 2px 8px;
    border-radius: 12px;
}

.cart-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    background-color: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: 1001;
    overflow: hidden;
}

.cart-wrapper:hover .cart-dropdown,
.cart-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cart-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
}

.cart-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.cart-items {
    max-height: 320px;
    overflow-y: auto;
    padding: 20px;
}

.cart-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 0;
    font-size: 14px;
}

.cart-footer {
    padding: 18px 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-light);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.checkout-btn {
    width: 100%;
    padding: 14px;
    background-color: var(--accent-color);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: background-color var(--transition-fast);
}

.checkout-btn:hover {
    background-color: var(--accent-hover);
}

.cart-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.cart-item-img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cart-item-name {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
}

.cart-item-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent-color);
}

.cart-item-qty {
    display: flex;
    align-items: center;
}

.cart-item-qty .qty-input {
    width: 56px;
    height: 34px;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
}

/* Cart item actions for dynamic cart */
.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.cart-item-remove {
    color: var(--text-light);
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.cart-item-remove:hover {
    color: #e74c3c;
    background-color: #fdf2f2;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.qty-btn:hover {
    background-color: var(--accent-light);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.cart-item-qty-value {
    min-width: 24px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

.banner {
    background: linear-gradient(135deg, var(--accent-color) 0%, #00cec9 100%);
    padding: 48px 24px;
    text-align: center;
}

.banner-content {
    max-width: 600px;
    margin: 0 auto;
}

.banner h1 {
    font-size: 32px;
    font-weight: 700;
    color: white;
    margin-bottom: 10px;
}

.banner p {
    font-size: 17px;
    color: rgba(255, 255, 255, 0.9);
}

.breadcrumb {
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 14px 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--accent-color);
}

.breadcrumb-sep {
    color: var(--text-light);
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

.main-content {
    padding: 32px 0;
    min-height: calc(100vh - var(--header-height) - 300px);
}

.main-content > .container {
    display: flex;
    gap: 32px;
    flex-direction: row;
}

.products-section {
    flex: 1;
    min-width: 0;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.product-count {
    font-size: 14px;
    color: var(--text-secondary);
    background: var(--accent-light);
    padding: 6px 14px;
    border-radius: 20px;
}

.products-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.product-card {
    width: calc(33.333% - 16px);
    min-width: 260px;
    background-color: var(--bg-white);
    border-radius: 16px;
    overflow: hidden;
    transition: all var(--transition-normal);
    border: 1px solid var(--border-color);
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.product-link {
    display: block;
    text-decoration: none;
}

.product-link:hover {
    text-decoration: none;
}

.product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background-color: var(--bg-light);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

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

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: var(--accent-color);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    text-transform: uppercase;
}

.product-info {
    padding: 20px;
}

.product-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-color);
}

.add-cart-btn {
    padding: 10px 18px;
    background-color: var(--accent-color);
    color: white;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.add-cart-btn:hover {
    background-color: var(--accent-hover);
    transform: scale(1.05);
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-section {
    background-color: var(--bg-white);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent-color);
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-link {
    display: block;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    border-radius: 8px;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.category-link:hover {
    background-color: var(--accent-light);
    color: var(--accent-color);
    text-decoration: none;
    border-left-color: var(--accent-color);
}

.category-link.active {
    background-color: var(--accent-light);
    color: var(--accent-color);
    font-weight: 600;
    border-left-color: var(--accent-color);
}

.product-detail-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 32px 24px;
    display: flex;
    gap: 48px;
}

.product-gallery {
    width: 48%;
    flex-shrink: 0;
}

.main-image {
    width: 100%;
    aspect-ratio: 1;
    background-color: var(--bg-white);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

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

.thumbnail-row {
    display: flex;
    gap: 12px;
}

.thumbnail {
    width: 90px;
    height: 90px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.thumbnail:hover,
.thumbnail.active {
    border-color: var(--accent-color);
}

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

.product-detail-info {
    flex: 1;
    min-width: 0;
}

.product-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 16px;
}

.product-meta {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 20px;
}

.product-sku {
    font-size: 14px;
    color: var(--text-secondary);
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stars {
    color: var(--warning-color);
    font-size: 16px;
}

.rating-text {
    font-size: 14px;
    color: var(--link-color);
}

.product-price-large {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 24px;
}

.product-description {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 28px;
}

.product-options {
    margin-bottom: 28px;
}

.option-group {
    margin-bottom: 20px;
}

.option-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.color-options {
    display: flex;
    gap: 12px;
}

.color-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    transition: all var(--transition-fast);
}

.color-btn:hover,
.color-btn.active {
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.color-btn[data-color="black"] { background-color: #2d3436; }
.color-btn[data-color="white"] { background-color: #dfe6e9; }
.color-btn[data-color="blue"] { background-color: #0984e3; }

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    width: fit-content;
}

.qty-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.qty-btn:hover {
    background-color: var(--accent-light);
    color: var(--accent-color);
}

.qty-input {
    width: 60px;
    height: 44px;
    border: none;
    border-left: 2px solid var(--border-color);
    border-right: 2px solid var(--border-color);
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    outline: none;
}

.product-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
}

.btn-primary,
.btn-secondary {
    padding: 16px 36px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--bg-light);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.product-features {
    margin-bottom: 28px;
}

.product-features h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.product-features ul {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-features li {
    font-size: 14px;
    color: var(--text-secondary);
    padding-left: 26px;
    position: relative;
}

.product-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: 600;
}

.product-shipping {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
    background-color: var(--accent-light);
    border-radius: 12px;
}

.shipping-item {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    color: var(--text-secondary);
}

.shipping-item svg {
    flex-shrink: 0;
    color: var(--accent-color);
}

.related-products {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 50px 24px;
    border-top: 1px solid var(--border-color);
}

.related-header {
    margin-bottom: 30px;
}

.related-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.related-card {
    background-color: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    transition: all var(--transition-normal);
    border: 1px solid var(--border-color);
}

.related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.related-link {
    display: block;
    text-decoration: none;
}

.related-link:hover {
    text-decoration: none;
}

.related-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background-color: var(--bg-light);
}

.related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

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

.related-info {
    padding: 16px;
    text-align: center;
}

.related-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.related-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-color);
}

.footer {
    background-color: var(--primary-color);
    color: var(--bg-white);
    padding-top: 60px;
}

.footer-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

.footer-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 18px;
    color: white;
}

.footer-section p {
    font-size: 14px;
    color: #b2bec3;
    line-height: 1.7;
}

.footer-section ul {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-section a {
    font-size: 14px;
    color: #b2bec3;
    transition: color var(--transition-fast);
}

.footer-section a:hover {
    color: var(--accent-color);
}

.newsletter-form {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.newsletter-form input {
    flex: 1;
    padding: 12px 14px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
}

.newsletter-form button {
    padding: 12px 18px;
    background-color: var(--accent-color);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: background-color var(--transition-fast);
}

.newsletter-form button:hover {
    background-color: var(--accent-hover);
}

.footer-bottom {
    margin-top: 50px;
    padding: 24px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    font-size: 13px;
    color: #636e72;
}

/* Loading Spinner */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.loading-state p {
    margin-top: 16px;
    color: var(--text-secondary);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}

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

@media (max-width: 1200px) {
    .product-card {
        width: calc(50% - 12px);
    }

    .sidebar {
        width: 240px;
    }
}

@media (max-width: 992px) {
    .main-content > .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-section {
        flex: 1;
        min-width: 200px;
    }

    .product-detail-container {
        flex-direction: column;
    }

    .product-gallery,
    .product-detail-info {
        width: 100%;
    }

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

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

@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
        height: auto;
        padding: 16px 24px;
        gap: 16px;
    }

    .search-bar {
        order: 3;
        width: 100%;
        max-width: none;
    }

    .banner h1 {
        font-size: 24px;
    }

    .product-card {
        width: 100%;
    }

    .product-actions {
        flex-direction: column;
    }

    .footer-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        gap: 16px;
    }

    .product-info {
        padding: 16px;
    }
}

.hidden {
    display: none !important;
}

.auth-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-container {
    max-width: 520px;
    margin: 40px auto;
    padding: 0 24px;
}

.auth-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.04);
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

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

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition-fast);
    background: var(--bg-white);
}

.form-input:focus {
    border-color: var(--accent-color);
}

.form-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.form-error {
    color: #e74c3c;
    font-size: 14px;
    margin: 10px 0;
}

.auth-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.btn-primary {
    background: var(--accent-color);
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.auth-link {
    color: var(--link-color);
}
