/* Main Styles for YashStore */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --gray-color: #f7f9fa;
    --success-color: #27ae60;
    --warning-color: #f1c40f;
    --error-color: #c0392b;
    
    /* Theme variables - Light mode (default) */
    --bg-color: #ffffff;
    --bg-secondary: #f7f9fa;
    --text-color: #2c3e50;
    --text-secondary: #4a4a4a;
    --border-color: #eaeaea;
    --header-bg: #ffffff;
    --footer-bg: #ffffff;
    --footer-text: #bbb;
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.08);
    --card-shadow-hover: rgba(0, 0, 0, 0.12);
    --overlay-bg: rgba(255, 255, 255, 0.85);
}

/* Dark mode theme variables */
[data-theme="dark"] {
    --primary-color: #8eb8e0;
    --secondary-color: #9fb9d9;
    --accent-color: #e74c3c;
    --light-color: #1a1a1a;
    --dark-color: #e1e1e1;
    --gray-color: #2d2d2d;
    
    --bg-color: #121212;
    --bg-secondary: #1e1e1e;
    --text-color: #e1e1e1;
    --text-secondary: #b0b0b0;
    --border-color: #383838;
    --header-bg: #1a1a1a;
    --footer-bg: #1a1a1a;
    --footer-text: #888;
    --card-bg: #252525;
    --card-shadow: rgba(0, 0, 0, 0.2);
    --card-shadow-hover: rgba(0, 0, 0, 0.4);
    --overlay-bg: rgba(18, 18, 18, 0.85);
}

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

html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    background-image: url('https://i.pinimg.com/736x/c2/6e/ae/c26eae7342953a805d6466315b909f28.jpg');
    background-attachment: fixed;
    background-repeat: repeat;
    background-size: 180px;
    transition: color 0.3s ease, background-color 0.3s ease;
}

/* Apply a darker filter to the background pattern in dark mode */
[data-theme="dark"] body {
    background-image: url('https://i.pinimg.com/736x/c2/6e/ae/c26eae7342953a805d6466315b909f28.jpg');
    background-blend-mode: multiply;
    filter: brightness(0.9);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Main content wrapper to push footer down */
.page-content {
    flex: 1 0 auto;
    position: relative;
    z-index: 1;
}

/* Add a semi-transparent overlay to improve content readability */
.page-content::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    z-index: -1;
    transition: background-color 0.3s ease;
}

/* Disable the overlay in dark mode for a cleaner look */
[data-theme="dark"] .page-content::before {
    opacity: 0;
    /* Alternative approach: you can use display: none; or visibility: hidden; instead */
}

/* Typography */
h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
    color: var(--text-color);
    transition: color 0.3s ease;
}

p {
    margin-bottom: 15px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

a {
    text-decoration: none;
    color: var(--secondary-color);
    transition: color 0.2s ease;
}

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

.btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3);
}

/* Button loading state */
button.loading {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

button.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: inherit;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spinner {
    animation: spin 1s linear infinite;
    margin-right: 5px;
}

.section-title {
    text-align: center;
    margin: 40px 0 30px;
    color: var(--secondary-color);
    font-size: 2rem;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-title:after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: var(--accent-color);
    margin: 15px auto;
}

.center {
    text-align: center;
    margin: 30px 0;
}

/* Header */
header {
    background-color: var(--header-bg);
    box-shadow: 0 2px 10px var(--card-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

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

.logo h1 {
    color: var(--accent-color);
    font-size: 1.8rem;
    margin: 0;
    transition: transform 0.3s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.logo a {
    text-decoration: none;
    color: inherit;
}

.logo a:hover h1 {
    transform: scale(1.05);
}

.cart-icon a {
    font-size: 1.2rem;
    position: relative;
    color: var(--text-color);
    transition: color 0.2s ease;
}

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

/* Cart count styles */
#cart-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    padding: 2px 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

/* Animation for cart count updates */
@keyframes pulse-count {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

#cart-count.updating {
    animation: pulse-count 0.3s ease;
    background-color: var(--success-color);
}

/* Hero Section */
.hero {
    background-image: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('../images/hero-bg.jpg');
    background-size: cover;
    background-position: center;
    color: rgb(255, 255, 255);
    padding: 120px 0;  /* Increased padding for more impact */
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    animation: slideUp 0.8s ease-out;
    position: relative;
    z-index: 2;
}

.hero-content h2 {
    font-size: 2.8rem;  /* Larger size for more impact */
    margin-bottom: 20px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.3);
    letter-spacing: 1px;
    color: #ffffff !important; /* Force white text regardless of theme */
}

.hero-content p {
    margin-bottom: 30px;
    font-size: 1.2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    color: rgba(255, 255, 255, 0.9) !important; /* Force light text regardless of theme */
    text-shadow: 0 1px 3px rgba(0,0,0,0.2); /* Add subtle text shadow for better readability */
}

/* Ensure hero button text is also always light */
.hero-content .btn {
    color: #ffffff !important;
}

/* Product Cards */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.product-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    animation: fadeIn 0.6s ease-out;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 25px var(--card-shadow-hover);
}

.product-image {
    position: relative;
    height: 250px;
    background: var(--bg-secondary) url('https://via.placeholder.com/300x300?text=Loading...') no-repeat center;
    background-size: 50px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease;
}

.product-image.loading {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { background-color: #f9f9f9; }
    50% { background-color: #f0f0f0; }
    100% { background-color: #f9f9f9; }
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;  /* Slower transition for smoother effect */
    opacity: 1;
}

/* Hide broken images until they're replaced */
img[src=""], img:not([src]) {
    opacity: 0;
}

/* Show fallback image with proper styling */
img.placeholder, img.error {
    opacity: 1;
    object-fit: contain;
    padding: 20px;
    background-color: #f7f7f7;
}

/* Fallback for images */
.product-image img:not([src]), 
.product-image img[src=""] {
    opacity: 0;
}

.product-image::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary-color);
    font-size: 14px;
    opacity: 0.7;
    display: none;
}

.product-card.loading .product-image::after {
    display: block;
}

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

/* Fix for lazy loading */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded,
img.loaded {
    opacity: 1;
}

/* Placeholder styling */
.placeholder {
    background: linear-gradient(90deg, var(--gray-color) 0%, #f0f0f0 50%, var(--gray-color) 100%);
    background-size: 200% 100%;
    animation: loading-gradient 1.5s ease-in-out infinite;
    width: 100%;
    height: 100%;
}

@keyframes loading-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.product-overlay button {
    background-color: white;
    color: var(--secondary-color);
    border: none;
    padding: 10px 20px;
    margin: 5px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.product-overlay button:hover {
    background-color: var(--accent-color);
    color: white;
    transform: translateY(-2px);
}

.product-info {
    padding: 20px 15px;
}

.product-info h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.product-card:hover .product-info h3 {
    color: var(--accent-color);
}

.price {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 1.1rem;
}

/* Testimonials */
.testimonials {
    background-color: var(--gray-color);
    padding: 60px 0;
}

.testimonial {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    max-width: 800px;
    margin: 0 auto;
}

.stars {
    color: gold;
    margin-bottom: 15px;
}

.customer {
    font-weight: 500;
    color: var(--secondary-color);
    text-align: right;
}

/* Footer */
footer {
    flex-shrink: 0;
    background-color: var(--footer-bg);
    padding: 30px 0;
    text-align: center;
    margin-top: auto;
    position: relative;
    z-index: 10;
    transition: background-color 0.3s ease;
}

.copyright {
    color: var(--footer-text);
    font-size: 0.9rem;
    text-align: center;
    transition: color 0.3s ease;
}

/* Mobile menu */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 200;
    position: relative;
}

.mobile-menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: transform 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Notification system */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background-color: white;
    color: var(--dark-color);
    border-radius: 5px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.2);
    z-index: 1500;
    transform: translateX(150%);
    transition: transform 0.3s ease-out;
    display: flex;
    align-items: center;
}

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

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification.error {
    border-left: 4px solid var(--error-color);
}

.notification.info {
    border-left: 4px solid var(--primary-color);
}

.notification-content {
    display: flex;
    align-items: center;
}

.notification i {
    margin-right: 10px;
    font-size: 1.2rem;
}

.notification.success i {
    color: var(--success-color);
}

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

.notification.info i {
    color: var(--primary-color);
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    nav ul {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background: white;
        padding: 20px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        z-index: 100;
    }

    nav ul.active {
        transform: translateY(0);
    }

    .logo h1 {
        font-size: 1.4rem;
    }

    .hero-content h2 {
        font-size: 1.7rem;
    }
    
    .hero {
        padding: 80px 0;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .product-card {
        margin-bottom: 15px;
    }
    
    .product-overlay button {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    
    .container {
        width: 95%;
        padding: 0 10px;
    }
    
    .product-image {
        height: 180px;
    }
    
    .product-info h3 {
        font-size: 0.95rem;
    }
    
    .price {
        font-size: 0.95rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }
    
    .section-title {
        font-size: 1.6rem;
        margin: 30px 0 20px;
    }
    
    .page-header h1 {
        font-size: 1.8rem;
    }
    
    .notification {
        width: 90%;
        right: 5%;
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    header .container {
        padding: 10px 15px;
    }
    
    footer {
        padding: 20px 0;
    }
    
    .copyright {
        font-size: 0.8rem;
    }
}

@media screen and (max-width: 480px) {
    .hero-content h2 {
        font-size: 1.5rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .hero {
        padding: 60px 0;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .product-image {
        height: 150px;
    }
    
    .product-overlay {
        flex-direction: column;
        gap: 5px;
    }
    
    .product-overlay button {
        width: 90%;
        padding: 8px 10px;
        font-size: 0.7rem;
        margin: 2px;
    }
    
    .product-info {
        padding: 15px 10px;
    }
    
    .product-info h3 {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    
    .price {
        font-size: 0.9rem;
    }
    
    .mobile-menu-toggle {
        width: 24px;
        height: 18px;
    }
    
    .cart-icon a {
        font-size: 1rem;
    }
    
    #cart-count {
        font-size: 0.65rem;
        padding: 1px 4px;
    }
    
    /* Improve touch targets */
    button, 
    .btn,
    .product-overlay button,
    .quantity-btn,
    .back-button,
    .remove-item,
    .cart-icon a {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Touch-friendly focus states */
button:focus,
a:focus,
input:focus,
.btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Professional Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Dark Mode Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 15px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.theme-toggle:hover {
    background-color: var(--gray-color);
}

.theme-toggle i {
    color: var(--text-color);
    font-size: 1.1rem;
    transition: transform 0.3s ease, color 0.3s ease;
}

.theme-toggle:hover i {
    transform: rotate(30deg);
}

/* Theme transition animation */
.theme-transition,
.theme-transition *,
.theme-transition *:before,
.theme-transition *:after {
    transition: all 0.3s ease !important;
    transition-delay: 0 !important;
}

/* Style for the header-right container */
.header-right {
    display: flex;
    align-items: center;
}
