/**
 * Design Enhancements
 */

/* Smooth Transitions */
* {
    transition: opacity 0.2s ease, transform 0.3s ease, background-color 0.2s ease;
}

/* Selection Color */
::selection {
    background: var(--color-text);
    color: var(--color-bg);
}

::-moz-selection {
    background: var(--color-text);
    color: var(--color-bg);
}

/* Focus Styles */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Loading Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product {
    animation: fadeIn 0.4s ease forwards;
}

.product:nth-child(1) { animation-delay: 0.05s; }
.product:nth-child(2) { animation-delay: 0.1s; }
.product:nth-child(3) { animation-delay: 0.15s; }
.product:nth-child(4) { animation-delay: 0.2s; }
.product:nth-child(5) { animation-delay: 0.25s; }
.product:nth-child(6) { animation-delay: 0.3s; }

/* Image Lazy Load Effect */
.product-image {
    position: relative;
    background: linear-gradient(90deg, #f0f0f0 0%, #f5f5f5 50%, #f0f0f0 100%);
    background-size: 200% 100%;
}

.product-image.loading::before {
    opacity: 1;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Filter Accordion Animation */
.filter-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.filter-list.active {
    max-height: 1000px;
}

.filter-toggle {
    transition: transform 0.3s ease;
}

.filter-title.active .filter-toggle {
    transform: rotate(45deg);
}

/* Button Hover Effects */
button,
.button,
.add-to-cart-button,
.single_add_to_cart_button {
    position: relative;
    overflow: hidden;
}

button::before,
.button::before,
.add-to-cart-button::before,
.single_add_to_cart_button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

button:hover::before,
.button:hover::before,
.add-to-cart-button:hover::before,
.single_add_to_cart_button:hover::before {
    width: 300px;
    height: 300px;
}

/* Price Animation */
.product-price {
    display: inline-block;
    position: relative;
}

.product-price::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-text);
    transition: width 0.3s ease;
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: var(--color-text);
    z-index: 1000;
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.1s ease;
}

/* Enhanced Newsletter Form */
.newsletter-form {
    position: relative;
}

.newsletter-form input:focus {
    border-color: var(--color-text);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.newsletter-form button {
    position: relative;
    overflow: hidden;
}

.newsletter-form button::after {
    content: '→';
    position: absolute;
    right: 10px;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.newsletter-form button:hover::after {
    opacity: 1;
    transform: translateX(0);
}

/* Cart Icon Bounce */
@keyframes cartBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.cart-icon.updated {
    animation: cartBounce 0.4s ease;
}

/* Filter Active State */
.filter-list a.active {
    font-weight: 600;
    position: relative;
    padding-left: 12px;
}

.filter-list a.active::before {
    content: '→';
    position: absolute;
    left: 0;
    font-size: 10px;
}

/* Product Count Badge */
.products-count {
    display: inline-block;
    padding: 2px 8px;
    background: var(--color-accent);
    font-size: 11px;
    border-radius: 2px;
    margin-left: 8px;
}

/* Enhanced Sort Links */
.products-sort a {
    position: relative;
    padding-bottom: 2px;
    text-decoration: none;
}

.products-sort a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-text);
    transition: width 0.3s ease;
}

.products-sort a:hover::after,
.products-sort a.active::after {
    width: 100%;
}

/* Skeleton Loading for Images */
@keyframes skeleton {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.product-image img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-image img.loaded {
    opacity: 1;
}

/* Enhanced Footer Links */
/* Footer links: underline only by text width */
.footer-column a {
    position: relative;
    display: inline-block; /* limit width to link, not column */
    width: auto;
    text-decoration: none;
}

.footer-column a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-text);
    transition: width 0.3s ease;
}

.footer-column a:hover::after {
    width: 100%;
}

/* Top Banner Animation */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.top-banner {
    animation: slideDown 0.4s ease;
}

/* Search Toggle Animation */
.search-toggle {
    position: relative;
}

.search-toggle::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-text);
    transition: width 0.3s ease;
}

.search-toggle:hover::after {
    width: 100%;
}

/* Mobile Menu Animation */
@media (max-width: 768px) {
    .main-navigation {
        animation: fadeIn 0.3s ease;
    }
}

/* Enhanced Border Radius */
.product-image,
.newsletter-form input,
.newsletter-form button {
    border-radius: 2px;
}

/* Smooth Color Transitions */
a,
button {
    transition: color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease, transform 0.3s ease;
}

/* Enhanced Focus Visible */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 4px;
}

/* Cursor Pointer for Interactive Elements */
.filter-title,
.cart-icon,
.search-toggle,
.newsletter-form button {
    cursor: pointer;
}

/* Disable Transitions on Page Load */
.preload * {
    transition: none !important;
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--color-text);
    color: var(--color-bg);
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.scroll-to-top:active {
    transform: translateY(-2px);
}

/* Enhanced Product Grid Spacing */
.products {
    margin-top: var(--spacing-md);
}

/* Improved Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* Better Link Underlines */
a {
    text-decoration-skip-ink: auto;
}

/* Enhanced Input Styles */
input[type="text"],
input[type="email"],
input[type="search"],
input[type="number"],
select,
textarea {
    font-family: var(--font-primary);
    border: 1px solid var(--color-border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="search"]:hover,
input[type="number"]:hover,
select:hover,
textarea:hover {
    border-color: var(--color-text);
}

/* Product Meta Enhancements */
.product-meta {
    font-variant-numeric: tabular-nums;
}

/* Enhanced Header Transition */
.site-header {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Better Mobile Touch Targets */
@media (max-width: 768px) {
    button,
    a,
    .filter-title {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Print Styles */
@media print {
    .site-header,
    .site-footer,
    .filter-sidebar,
    .scroll-to-top,
    .scroll-progress {
        display: none;
    }
    
    .product {
        page-break-inside: avoid;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode
    :root {
        --color-bg: #000000;
        --color-text: #ffffff;
        --color-border: #333333;
        --color-hover: #1a1a1a;
        --color-accent: #222222;
    }
    */
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --color-border: #000000;
    }
    
    a:hover {
        opacity: 1;
        text-decoration: underline;
    }

    /* Keep clean custom underline for sorting and footer */
    .products-sort a:hover,
    .footer-column a:hover {
        text-decoration: none;
    }
}

/* Custom Add to Cart Notification */
.cart-notification {
    position: fixed;
    top: 100px;
    right: -400px;
    width: 350px;
    background: var(--color-bg);
    border: 1px solid var(--color-text);
    padding: var(--spacing-md);
    z-index: 9999;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.cart-notification.show {
    right: var(--spacing-md);
}

.cart-notification-content {
    display: flex;
    gap: var(--spacing-sm);
    align-items: flex-start;
}

.cart-notification-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.cart-notification-icon svg {
    width: 100%;
    height: 100%;
    stroke: var(--color-text);
}

.cart-notification-text {
    flex: 1;
}

.cart-notification-title {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-notification-message {
    font-size: 13px;
    color: var(--color-text);
    opacity: 0.7;
    margin-bottom: var(--spacing-sm);
}

.cart-notification-actions {
    display: flex;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
}

.cart-notification-btn {
    flex: 1;
    padding: 8px 16px;
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid var(--color-text);
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.cart-notification-btn:hover {
    background: var(--color-text);
    color: var(--color-bg);
}

.cart-notification-btn.primary {
    background: var(--color-text);
    color: var(--color-bg);
}

.cart-notification-btn.primary:hover {
    opacity: 0.8;
}

.cart-notification-close {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.cart-notification-close:hover {
    opacity: 1;
}

.cart-notification-close svg {
    width: 16px;
    height: 16px;
    stroke: var(--color-text);
}

@media (max-width: 768px) {
    .cart-notification {
        width: calc(100% - var(--spacing-md) * 2);
        right: -100%;
    }
    
    .cart-notification.show {
        right: var(--spacing-sm);
    }
}

/* Image Lightbox */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    margin: 0 auto;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    color: white;
    border: none;
    font-size: 40px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.lightbox-close:hover {
    opacity: 0.7;
}

/* Gallery cursor */
.gallery-image {
    cursor: zoom-in;
}

.gallery-image:hover::after {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    opacity: 0.8;
    pointer-events: none;
}
