/**
 * HCommerce - Main Stylesheet
 * A clean, modern e-commerce design
 */

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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --bg-light: #f8fafc;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

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

.main-nav a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.main-nav a:hover {
    color: var(--primary-color);
}

.main-nav a.active {
    color: var(--primary-color);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -12px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Main Content */
.main-content {
    min-height: 60vh;
    padding: 2rem 0;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0;
    background: linear-gradient(135deg, var(--bg-light) 0%, #fff 100%);
    border-radius: 1rem;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

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

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: var(--secondary-color);
    color: #fff;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-text {
    background: transparent;
    color: var(--text-light);
    padding: 0.5rem 1rem;
}

.btn-text:hover {
    color: var(--primary-color);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

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

.product-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.product-image-placeholder {
    color: var(--text-light);
    font-size: 0.875rem;
}

.product-info {
    padding: 1.25rem;
}

.product-info h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.product-info h3 a {
    color: var(--text-dark);
    text-decoration: none;
}

.product-info h3 a:hover {
    color: var(--primary-color);
}

.product-description {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.product-type, .out-of-stock, .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

.product-type {
    background: var(--bg-light);
    color: var(--text-light);
}

.out-of-stock {
    background: #fee2e2;
    color: var(--error-color);
}

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

.compare-price {
    text-decoration: line-through;
    color: var(--text-light);
    font-size: 0.875rem;
}

.price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Product Detail */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin: 2rem 0;
}

.product-images .main-image {
    width: 100%;
    height: 500px;
    background: var(--bg-light);
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

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

.image-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.thumbnail {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 0.5rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

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

.product-details h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.product-price-section {
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.savings {
    background: var(--success-color);
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.product-quantity {
    margin: 1.5rem 0;
}

.quantity-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s;
}

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

.qty-field {
    width: 80px;
    height: 40px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.low-stock {
    display: block;
    margin-top: 0.5rem;
    color: var(--error-color);
    font-size: 0.875rem;
    font-weight: 600;
}

.product-actions {
    margin: 2rem 0;
}

.shipping-info, .digital-info, .service-info {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 0.75rem;
}

.shipping-info h3, .digital-info h3, .service-info h3 {
    margin-bottom: 1rem;
}

.product-categories {
    margin-top: 2rem;
}

.category-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 0.5rem;
    margin-right: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.category-tag:hover {
    background: var(--primary-color);
    color: #fff;
}

/* Filters */
.products-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.filters {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.filter-section {
    margin-bottom: 2rem;
}

.filter-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.price-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.price-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.products-main {
    flex: 1;
}

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

.sort-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: #fff;
}

/* Cart Page */
.cart-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 3rem;
    margin-top: 2rem;
}

.empty-cart {
    text-align: center;
    padding: 4rem 2rem;
}

.cart-item {
    display: grid;
    grid-template-columns: 100px 1fr auto auto auto auto;
    gap: 1.5rem;
    align-items: center;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.cart-item-image {
    width: 100px;
    height: 100px;
    background: var(--bg-light);
    border-radius: 0.5rem;
    overflow: hidden;
}

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

.cart-item-details h3 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.variant-info, .sku, .item-type {
    font-size: 0.875rem;
    color: var(--text-light);
}

.cart-item-price, .cart-item-total {
    font-weight: 600;
    font-size: 1.125rem;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.btn-remove:hover {
    color: var(--error-color);
}

.cart-summary {
    position: sticky;
    top: 100px;
    height: fit-content;
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 0.75rem;
}

.cart-summary h2 {
    margin-bottom: 1.5rem;
}

.discount-code {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.form-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.discount-message {
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.discount-message.success {
    background: #d1fae5;
    color: var(--success-color);
}

.discount-message.error {
    background: #fee2e2;
    color: var(--error-color);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.summary-row.total-row {
    font-size: 1.25rem;
    border-top: 2px solid var(--text-dark);
    padding-top: 1rem;
}

/* Checkout */
.checkout-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 3rem;
    margin-top: 2rem;
}

.form-section {
    margin-bottom: 2rem;
    padding: 2rem;
    background: var(--bg-light);
    border-radius: 0.75rem;
}

.form-section h2 {
    margin-bottom: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.payment-option:has(input:checked) {
    border-color: var(--primary-color);
    background: #eff6ff;
}

#stripe-card-element {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: #fff;
}

.manual-payment-info {
    padding: 1.5rem;
    background: #fef3c7;
    border-radius: 0.5rem;
    border-left: 4px solid #f59e0b;
}

.order-summary {
    position: sticky;
    top: 100px;
    height: fit-content;
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 0.75rem;
}

.checkout-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-name {
    font-weight: 600;
}

.item-variant, .item-quantity {
    font-size: 0.875rem;
    color: var(--text-light);
}

.error-message, .success-message {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    display: none;
}

.error-message {
    background: #fee2e2;
    color: var(--error-color);
}

.success-message {
    background: #d1fae5;
    color: var(--success-color);
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.category-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-dark);
    transition: transform 0.2s, box-shadow 0.2s;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.category-image {
    width: 100%;
    height: 150px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.category-card h3, .category-card p {
    padding: 0 1.25rem;
}

.category-card h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.category-card p {
    padding-bottom: 1.25rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Footer */
.site-footer {
    background: var(--text-dark);
    color: #fff;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: #94a3b8;
    text-decoration: none;
}

.footer-section a:hover {
    color: #fff;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #475569;
    color: #94a3b8;
}

/* Notifications */
.notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: var(--success-color);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(400px);
    transition: transform 0.3s;
    z-index: 1000;
}

.notification.show {
    transform: translateX(0);
}

.notification-error {
    background: var(--error-color);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-light);
}

.no-products {
    text-align: center;
    padding: 4rem;
    color: var(--text-light);
    grid-column: 1 / -1;
}

/* Breadcrumbs */
.breadcrumbs {
    padding: 1rem 0;
    font-size: 0.875rem;
    color: var(--text-light);
}

.breadcrumbs a {
    color: var(--text-light);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--primary-color);
}

.breadcrumbs span {
    color: var(--text-dark);
}

/* Share Buttons */
.share-buttons {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 0.5rem;
}

.share-buttons p {
    font-weight: 600;
    margin-bottom: 1rem;
}

.share-btn {
    padding: 0.5rem 1rem;
    margin-right: 0.5rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.share-btn:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Trust Badges */
.trust-badges {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
}

.trust-badges img {
    height: 50px;
    width: auto;
}

/* Product Reviews */
.product-reviews {
    margin-top: 3rem;
    padding: 2rem;
    background: var(--bg-light);
    border-radius: 0.75rem;
}

.product-reviews h2 {
    margin-bottom: 1.5rem;
}

/* Related Products */
.related-products {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 2px solid var(--border-color);
}

.related-products h2 {
    margin-bottom: 2rem;
}

/* Layout Variations */
.product-layout-wide .container {
    max-width: 1400px;
}

.product-layout-compact .product-detail {
    max-width: 900px;
    margin: 0 auto;
}

.layout-stacked .product-images {
    width: 100%;
    margin-bottom: 2rem;
}

.layout-stacked .product-details {
    width: 100%;
}

/* Image position right */
[data-image-position="right"] .product-images {
    order: 2;
}

[data-image-position="right"] .product-details {
    order: 1;
}

/* Responsive Design */
@media (max-width: 968px) {
    .product-detail {
        grid-template-columns: 1fr;
    }

    .cart-container,
    .checkout-container {
        grid-template-columns: 1fr;
    }

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

    .filters {
        position: static;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .cart-item {
        grid-template-columns: 80px 1fr;
        gap: 1rem;
    }

    .cart-item-quantity,
    .cart-item-price {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .main-nav {
        gap: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}
