:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --header-bg: #ffffff;
    --text-color: #333;
    --light-text: #777;
    --white: #ffffff;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --container-width: 1200px;
    --border-radius: 12px;
    --border-color: #ddd;
    --footer-bg: #1a1a1a;
    --footer-text: #f4f7f6;
}

[data-theme="dark"] {
    --primary-color: #5dade2;
    --secondary-color: #ecf0f1;
    --accent-color: #ff6b6b;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --header-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --light-text: #b0b0b0;
    --border-color: #333;
    --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Header */
.main-header {
    background: var(--header-bg);
    padding: 0.8rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

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

.logo h1 {
    font-size: 1.8rem;
    color: var(--secondary-color);
    cursor: pointer;
    font-weight: 800;
}

.logo span {
    color: var(--primary-color);
}

.search-bar {
    position: relative;
    flex: 0 1 400px;
    margin: 0 1rem;
}

.search-bar input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    font-size: 1rem;
    outline: none;
    background: var(--card-bg);
    color: var(--text-color);
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.2);
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--light-text);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.action-btn, .wishlist-icon, .cart-icon {
    position: relative;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--secondary-color);
    transition: var(--transition);
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover, .wishlist-icon:hover, .cart-icon:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background: var(--accent-color);
    color: var(--white);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 50%;
    font-weight: bold;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background: var(--primary-color);
    color: var(--white);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 50%;
    font-weight: bold;
}

/* User Profile Dropdown */
.user-profile {
    position: relative;
    cursor: pointer;
}

.avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    transition: var(--transition);
}

.user-profile:hover .avatar {
    transform: scale(1.05);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    border-radius: 8px;
    padding: 0.5rem 0;
    margin-top: 10px;
    display: none;
    flex-direction: column;
    z-index: 1001;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease;
}

.user-dropdown.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-dropdown a {
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.9rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.user-dropdown a:hover {
    background: rgba(52, 152, 219, 0.1);
    color: var(--primary-color);
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.5rem 0;
}

.user-dropdown a.logout {
    color: var(--accent-color);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    padding: 4rem 0;
    margin-bottom: 2rem;
    overflow: hidden;
}

[data-theme="dark"] .hero-section {
    background: linear-gradient(135deg, #1a1a1a 0%, #2c3e50 100%);
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.hero-text {
    flex: 1;
}

.hero-subtitle {
    color: var(--primary-color);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: block;
    margin-bottom: 1rem;
}

.hero-text h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
}

.hero-text h1 span {
    color: var(--primary-color);
}

.hero-text p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: var(--light-text);
    max-width: 500px;
}

.hero-btns {
    display: flex;
    gap: 1rem;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
}

.hero-image img {
    max-width: 100%;
    border-radius: 20px;
    box-shadow: 20px 20px 60px rgba(0,0,0,0.1);
    animation: float 6s ease-in-out infinite;
}

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

.btn-outline-white {
    background: transparent;
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
}

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

/* Controls Bar */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.6rem 1.5rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

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

.filter-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* Sorting */
.sorting {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sorting label {
    font-weight: 600;
    font-size: 0.9rem;
}

#sort-select {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    outline: none;
    cursor: pointer;
}

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

.product-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

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

.product-image {
    width: 100%;
    height: 250px;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .product-image {
    background: #252525;
}

.product-image img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: var(--transition);
}

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

.wishlist-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--white);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    color: var(--light-text);
    transition: var(--transition);
    border: none;
}

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

.wishlist-btn.active {
    color: var(--accent-color);
}

.product-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    font-size: 0.75rem;
    color: var(--primary-color);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.product-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
    font-weight: 700;
}

.product-rating {
    margin-bottom: 0.8rem;
    color: #f1c40f;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.rating-count {
    color: var(--light-text);
    font-size: 0.8rem;
    font-weight: 400;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-color);
    margin-top: auto;
}

.product-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.8rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: var(--transition);
    flex: 1;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: #2980b9;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

/* Cart & Wishlist Drawer */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--card-bg);
    box-shadow: -5px 0 25px rgba(0,0,0,0.2);
    z-index: 2000;
    transition: 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    display: flex;
    flex-direction: column;
}

.cart-drawer.open {
    right: 0;
}

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 {
    font-size: 1.3rem;
    font-weight: 800;
}

.cart-header button {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--light-text);
    transition: var(--transition);
}

.cart-header button:hover {
    color: var(--accent-color);
    transform: rotate(90deg);
}

.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.cart-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
    animation: slideInLeft 0.3s ease;
}

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

.cart-item-img {
    width: 70px;
    height: 70px;
    background: #f9f9f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .cart-item-img {
    background: #252525;
}

.cart-item-img img {
    max-width: 100%;
    max-height: 100%;
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.cart-item-price {
    color: var(--accent-color);
    font-weight: 800;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.cart-item-remove {
    color: var(--light-text);
    cursor: pointer;
    transition: var(--transition);
}

.cart-item-remove:hover {
    color: var(--accent-color);
}

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

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.checkout-btn {
    width: 100%;
    padding: 1.2rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.checkout-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 900px;
    border-radius: var(--border-radius);
    padding: 3rem;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--light-text);
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--accent-color);
    transform: rotate(90deg);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.modal-img {
    background: #f9f9f9;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .modal-img {
    background: #252525;
}

.modal-img img {
    max-width: 100%;
    transition: var(--transition);
}

.modal-img:hover img {
    transform: scale(1.05);
}

.modal-info {
    display: flex;
    flex-direction: column;
}

.modal-info h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
    font-weight: 800;
}

.modal-price {
    font-size: 2.2rem;
    color: var(--accent-color);
    font-weight: 900;
    margin-bottom: 1.5rem;
}

.modal-desc {
    color: var(--light-text);
    margin-bottom: 2.5rem;
    font-size: 1.05rem;
    line-height: 1.8;
}

/* Footer */
.main-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 5rem 0 0;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr;
    gap: 4rem;
    padding-bottom: 4rem;
}

.footer-brand .logo h1 {
    color: var(--white);
    margin-bottom: 1.5rem;
}

.footer-brand p {
    color: #bbb;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: #333;
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-5px);
}

.footer-links h3, .footer-newsletter h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--white);
}

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

.footer-links ul li {
    margin-bottom: 0.8rem;
}

.footer-links ul li a {
    color: #bbb;
    text-decoration: none;
    transition: var(--transition);
}

.footer-links ul li a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.footer-newsletter p {
    color: #bbb;
    margin-bottom: 1.5rem;
}

#newsletter-form {
    display: flex;
    gap: 0.5rem;
}

#newsletter-form input {
    flex: 1;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: none;
    outline: none;
}

.footer-disclaimer {
    background: rgba(0,0,0,0.1);
    padding: 1.5rem 0;
    text-align: center;
    border-top: 1px solid #333;
    font-size: 0.85rem;
    color: #999;
}

.footer-disclaimer a:hover {
    text-decoration: underline;
}

.footer-bottom {
    background: #000;
    padding: 1.5rem 0;
    text-align: center;
}

.footer-bottom p {
    font-size: 0.9rem;
    color: #777;
}

/* Notifications */
#notification-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

@media (max-width: 768px) {
    #notification-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .notification {
        min-width: 0;
        width: 100%;
        padding: 1rem;
        font-size: 0.9rem;
    }
}

.notification {
    background: var(--secondary-color);
    color: var(--white);
    padding: 1.2rem 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
    min-width: 300px;
    animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.notification.success {
    border-left: 6px solid #2ecc71;
}

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

/* Back to top button */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 1000;
    transition: var(--transition);
}

#back-to-top:hover {
    background: #2980b9;
    transform: translateY(-5px);
}

#back-to-top.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@media (max-width: 768px) {
    #back-to-top {
        bottom: 5rem;
        left: 1.5rem;
        width: 45px;
        height: 45px;
    }
}

/* Responsive Improvements */
@media (max-width: 1024px) {
    .hero-text h1 {
        font-size: 2.8rem;
    }
    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 0.5rem 0;
    }

    .header-content {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas: 
            "logo . actions"
            "search search search";
        gap: 0.8rem;
        align-items: center;
    }

    .logo {
        grid-area: logo;
    }

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

    .header-actions {
        grid-area: actions;
        gap: 1rem;
    }

    .search-bar {
        grid-area: search;
        margin: 0;
        width: 100%;
    }

    .search-bar input {
        padding: 0.6rem 1rem 0.6rem 2.2rem;
        font-size: 0.9rem;
    }

    .action-btn, .wishlist-icon, .cart-icon {
        font-size: 1.1rem;
    }

    .hero-section {
        padding: 2.5rem 0;
    }

    .hero-content {
        flex-direction: column-reverse;
        text-align: center;
    }

    .hero-text h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .hero-text p {
        font-size: 1rem;
        margin: 0 auto 1.5rem;
    }

    .hero-btns {
        justify-content: center;
        flex-direction: column;
        width: 100%;
    }

    .hero-btns .btn {
        width: 100%;
    }

    .hero-image img {
        max-width: 80%;
        margin-bottom: 1rem;
    }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1.2rem;
    }

    .filters {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .filters::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        white-space: nowrap;
        padding: 0.5rem 1.2rem;
        font-size: 0.9rem;
    }

    .sorting {
        justify-content: space-between;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }

    .product-image {
        height: 180px;
    }

    .product-info {
        padding: 1rem;
    }

    .product-title {
        font-size: 1rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

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

    .product-actions .btn {
        padding: 0.6rem;
        font-size: 0.85rem;
    }

    .modal-content {
        padding: 2rem 1.5rem;
        width: 95%;
    }

    .modal-body {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .modal-info h2 {
        font-size: 1.5rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }

    #newsletter-form {
        flex-direction: column;
    }

    .cart-drawer {
        width: 100%;
        max-width: none;
        right: -100%;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .logo h1 {
        font-size: 1.2rem;
    }
    
    .header-actions {
        gap: 0.8rem;
    }
}
