/* Custom CSS for Soap Bars & More */

/* Root variables for easy color management */
:root {
    --soap-dark: #1a1a1a;
    --soap-gold: #c9a961;
    --soap-light: #f5f5f5;
    --soap-accent: #6b6b6b;
}

/* Smooth scrolling for all elements */
* {
    scroll-behavior: smooth;
}

/* Body and general styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--soap-light);
}

::-webkit-scrollbar-thumb {
    background: var(--soap-gold);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #b8941f;
}

/* Navigation enhancements */
nav {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

nav.scrolled {
    background: rgba(26, 26, 26, 0.95);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

/* Hero section animations */
.hero-title {
    animation: fadeInUp 1s ease-out;
}

.hero-subtitle {
    animation: fadeInUp 1s ease-out 0.3s both;
}

.hero-buttons {
    animation: fadeInUp 1s ease-out 0.6s both;
}

/* Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Animation classes */
.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

.animate-fade-out {
    animation: fadeOut 0.3s ease-in;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

.animate-slide-out {
    animation: slideOut 0.3s ease-in;
}

.animate-slide-up {
    animation: slideUp 0.3s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-bounce {
    animation: bounce 2s infinite;
}

/* Button hover effects */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

/* Card hover effects */
.product-card {
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(201, 169, 97, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Product card content layout */
.product-card .p-6 {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-card .p-6 .flex.gap-2 {
    margin-top: auto;
}

/* Feature cards animation */
.feature-card {
    transition: all 0.3s ease;
}

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

.feature-icon {
    transition: all 0.3s ease;
}

.feature-card:hover .feature-icon {
    transform: scale(1.1);
    color: var(--soap-gold);
}

/* Filter section styling */
.filter-section {
    background: linear-gradient(135deg, var(--soap-light) 0%, #e8eef2 100%);
    border: 1px solid rgba(149, 165, 166, 0.2);
}

.filter-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--soap-light);
    border-radius: 50%;
    border-top-color: var(--soap-gold);
    animation: spin 1s ease-in-out infinite;
}

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

/* Notification styles */
.notification {
    animation: slideInRight 0.3s ease-out;
}

.notification.removing {
    animation: slideOutRight 0.3s ease-in;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive design enhancements */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .filter-section {
        padding: 1rem;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Contact section enhancements */
.contact-info {
    position: relative;
}

.contact-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: -20px;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--soap-gold), var(--soap-accent));
    border-radius: 2px;
}

/* Footer enhancements */
footer {
    background: linear-gradient(135deg, var(--soap-dark) 0%, #1a252f 100%);
}

.social-links a {
    transition: all 0.3s ease;
}

.social-links a:hover {
    transform: translateY(-3px);
    text-shadow: 0 4px 8px rgba(201, 169, 97, 0.3);
}

/* Scroll to top button */
#scroll-to-top {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}

#scroll-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Product image hover effect */
.product-image {
    transition: all 0.3s ease;
}

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

/* Price badge */
.price-badge {
    position: relative;
    z-index: 1;
}

.price-badge::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--soap-gold), #ddb96b);
    border-radius: 0.375rem;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Section dividers */
.section-divider {
    position: relative;
    text-align: center;
    margin: 3rem 0;
}

.section-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--soap-accent), transparent);
}

.section-divider span {
    background: white;
    padding: 0 2rem;
    color: var(--soap-accent);
    font-weight: 600;
}

/* Mobile menu animation */
.mobile-menu {
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

.mobile-menu.open {
    max-height: 300px;
}

/* Form enhancements */
.form-input {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.form-input:focus {
    border-color: var(--soap-gold);
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.1);
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--soap-light);
    border-top-color: var(--soap-gold);
    border-radius: 50%;
    animation: spin 1s ease-in-out infinite;
}

/* Tooltip styles */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--soap-dark);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.tooltip:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

/* Print styles */
@media print {
    nav, footer, .filter-section, #scroll-to-top {
        display: none !important;
    }
    
    .product-card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --soap-dark: #000000;
        --soap-light: #ffffff;
        --soap-accent: #666666;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Enhanced About Section Animations */
#about {
    position: relative;
    overflow: hidden;
}

/* Fade-in animation for about section cards */
#about .bg-white {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease-out forwards;
}

#about .bg-white:nth-child(1) {
    animation-delay: 0.1s;
}

#about .bg-white:nth-child(2) {
    animation-delay: 0.2s;
}

#about .bg-white:nth-child(3) {
    animation-delay: 0.3s;
}

/* Floating animation for decorative elements */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for icons */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Enhanced hover effects for about section */
#about .group:hover i {
    animation: pulse 1s infinite;
}

/* Gradient text animation */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Enhanced statistics counter animation */
#about .text-3xl {
    background: linear-gradient(45deg, var(--soap-gold), #e6d16a, var(--soap-gold));
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Box shadow enhancements */
#about .shadow-lg {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

#about .shadow-xl {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

#about .shadow-2xl {
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
}

/* Smooth transitions for all interactive elements */
#about a, #about .group {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced gradient backgrounds */
#about .bg-gradient-to-br {
    background-image: linear-gradient(to bottom right, var(--soap-dark), var(--soap-accent), #4a4a4a);
}

#about .bg-gradient-to-r {
    background-image: linear-gradient(to right, var(--soap-gold), #d4af37, #f4d03f);
}

/* Enhanced Product Image Styling */
.product-card img {
    width: 100%;
    height: 300px;
    object-fit: contain;
    object-position: center;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #ffffff 100%);
    border-radius: 0.75rem 0.75rem 0 0;
    padding: 0.5rem;
    transition: transform 0.25s ease, filter 0.25s ease;
    image-rendering: auto; /* let browser pick best interpolation */
    -ms-interpolation-mode: bicubic;
    will-change: transform, filter;
    filter: contrast(1.02) brightness(1.01);
}

.product-card:hover img {
    transform: scale(1.02);
    box-shadow: inset 0 0 20px rgba(201, 169, 97, 0.1);
}

/* List view specific styling */
.product-card .flex img {
    width: 100%;
    height: 100%;
    min-height: 200px;
    max-height: 250px;
    object-fit: contain;
    object-position: center;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #ffffff 100%);
    border-radius: 0.75rem;
    padding: 1rem;
    image-rendering: auto;
    -ms-interpolation-mode: bicubic;
    filter: contrast(1.02) brightness(1.01);
}

/* Sharp image rendering - optimized for product photos */
img {
    image-rendering: auto;
    -ms-interpolation-mode: bicubic;
    filter: contrast(1.03) brightness(1.01);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* High DPI screen support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .product-card img {
        image-rendering: auto;
        filter: contrast(1.08) brightness(1.02) saturate(1.04);
    }
}

/* Ultra high DPI screen support (3x and higher) */
@media (-webkit-min-device-pixel-ratio: 3), (min-resolution: 288dpi) {
    .product-card img {
        image-rendering: auto;
        filter: contrast(1.09) brightness(1.03) saturate(1.06);
        transform: translateZ(0);
    }
}

/* Container adjustments for better image display */
.product-card .relative {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 0.75rem 0.75rem 0 0;
    overflow: hidden;
}

/* Image loading states */
.product-card img[src=""], 
.product-card img:not([src]), 
.product-card img[src*="placeholder"] {
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
                linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    animation: loading-shimmer 2s linear infinite;
}

/* Image optimization for various states */
.product-card img.loading {
    filter: blur(2px) brightness(0.9);
    opacity: 0.7;
    transform: scale(0.98);
}

.product-card img.loaded {
    filter: contrast(1.1) brightness(1.02) saturate(1.05);
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s ease;
}

/* Sharpen images on hover */
.product-card:hover img.loaded {
    filter: contrast(1.15) brightness(1.03) saturate(1.1);
}

/* Error state for broken images */
.product-card img {
    position: relative;
}

.product-card img::after {
    content: '🧼';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card img[alt]:empty::after,
.product-card img:not([src])::after {
    opacity: 1;
}

@keyframes loading-shimmer {
    0% { background-position: 0 0, 0 10px, 10px -10px, -10px 0px; }
    100% { background-position: 20px 20px, 20px 30px, 30px 10px, 10px 20px; }
}

/* Lazy Loading Styles */
.product-card img[data-src] {
    opacity: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.product-card img.loaded {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.product-card img.loading {
    opacity: 0.7;
    filter: blur(2px);
    transition: all 0.3s ease-in-out;
}

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

/* Intersection Observer fallback */
.product-card img.lazy {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

.product-card img.lazy.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Pagination Styles */
#pagination-container {
    padding: 2rem 0;
    border-top: 1px solid rgba(107, 107, 107, 0.1);
}

#pagination-controls button {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

#pagination-controls button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#pagination-controls button:active:not(:disabled) {
    transform: translateY(0);
}

#pagination-controls button.active {
    background: var(--soap-gold);
    color: var(--soap-dark);
    border-color: var(--soap-gold);
    font-weight: 600;
}

#page-numbers button {
    min-width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#page-numbers button:hover:not(.active) {
    background: rgba(201, 169, 97, 0.1);
    border-color: var(--soap-gold);
}

#page-numbers button.active {
    background: var(--soap-gold);
    color: var(--soap-dark);
    border-color: var(--soap-gold);
    transform: scale(1.1);
}

/* Products per page selector styling */
#products-per-page {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    min-width: 150px;
}

/* Loading states for pagination */
#loading-indicator {
    animation: fadeIn 0.3s ease-out;
}

.fade-in-stagger {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.fade-in-stagger:nth-child(1) { animation-delay: 0.1s; }
.fade-in-stagger:nth-child(2) { animation-delay: 0.2s; }
.fade-in-stagger:nth-child(3) { animation-delay: 0.3s; }
.fade-in-stagger:nth-child(4) { animation-delay: 0.4s; }
.fade-in-stagger:nth-child(5) { animation-delay: 0.5s; }
.fade-in-stagger:nth-child(6) { animation-delay: 0.6s; }

/* Responsive pagination */
@media (max-width: 768px) {
    #pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    #page-numbers {
        order: -1;
        margin-bottom: 1rem;
    }
    
    #pagination-controls button {
        min-width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
    
    #page-numbers button {
        min-width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    #pagination-container .flex {
        flex-direction: column;
        space-y: 3;
    }
    
    #products-per-page {
        min-width: 120px;
        font-size: 0.875rem;
    }
    
    #pagination-info {
        text-align: center;
        margin: 0.5rem 0;
    }
}
