:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #343a40;
    --border-color: #dee2e6;
    --font-family: 'Poppins', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100vh;
}

.container {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    transition: margin-right 0.5s ease;
}

.container.cart-open {
    margin-right: 30%;
}

.product-view {
    width: 100%;
    height: 100vh;
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: width 0.5s ease;
}

.cart-view {
    width: 30%;
    height: 100vh;
    background-color: var(--surface-color);
    box-shadow: -5px 0 15px rgba(0,0,0,0.05);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    
    position: fixed;
    top: 0;
    right: 0;
    transform: translateX(100%);
    transition: transform 0.5s ease;
    z-index: 998;
}

.container.cart-open .cart-view {
    transform: translateX(0);
}

.close-cart-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-color);
    transition: color 0.2s ease;
}

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

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo img {
    height: 40px;
    margin-right: 10px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 500;
    position: relative;
    transition: color 0.3s ease;
}

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

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

nav a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
}

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

.search-bar {
    position: relative;
}

.search-bar input {
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.5rem 2rem 0.5rem 1rem;
    font-family: var(--font-family);
    transition: width 0.3s ease, box-shadow 0.3s ease;
    width: 150px;
}

.search-bar input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    width: 200px;
}

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

.cart-icon {
    position: relative;
    font-size: 1.5rem;
    cursor: pointer;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    transition: transform 0.2s ease, background-color 0.2s ease;
    transform: scale(0);
}

.cart-count.visible {
    transform: scale(1);
}

.cart-count.updated {
    transform: scale(1.2);
    background-color: #28a745;
}

/* Clear Filters Button */
.clear-filters-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.6rem;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-family: var(--font-family);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--secondary-color);
}

.clear-filters-btn:hover {
    border-color: #dc3545;
    background-color: #dc3545;
    color: white;
}

/* Main Content */
.content-area {
    display: flex;
    gap: 2rem;
    flex: 1;
}

/* Filters */
.filters {
    width: 200px;
}

.filters h3 {
    margin-bottom: 1.5rem;
}

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

.filter-group h4 {
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    cursor: pointer;
    color: var(--secondary-color);
}

.filter-group input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.price-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-top: 0.25rem;
}

/* Product Grid */
.product-grid-container {
    flex: 1;
}

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

.product-list-header h2 {
    margin: 0;
}

.sort-options select {
    padding: 0.5rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    font-family: var(--font-family);
    background-color: var(--surface-color);
}

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

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

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

.product-card {
    background: var(--surface-color);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.5s ease-out forwards;
    cursor: pointer;
}

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

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

.product-card img {
    max-width: 100%;
    height: 150px;
    object-fit: contain;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.product-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.add-to-cart-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-weight: 500;
    font-family: var(--font-family);
    transition: background-color 0.3s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

.add-to-cart-btn:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

.add-to-cart-btn.added {
    background-color: #28a745;
}

.add-to-cart-btn.added::before {
    content: '\f00c'; /* Font Awesome check icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-right: 0.5em;
}

/* Cart View */
.cart-content h3 {
    margin-bottom: 1.5rem;
    text-align: center;
}

#cart-items-container {
    height: 60vh;
    overflow-y: auto;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.empty-cart-message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--secondary-color);
    text-align: center;
}

.empty-cart-message i {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.continue-shopping {
    margin-top: 1rem;
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.continue-shopping:hover {
    background-color: var(--primary-color);
    color: white;
}

.cart-item {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    animation: fadeIn 0.4s ease-out;
}

.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-right: 1rem;
    background-color: var(--background-color);
    border-radius: 5px;
}

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

.cart-item-info h4 {
    font-size: 0.9rem;
    font-weight: 500;
}

.cart-item-info p {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
}

.remove-item-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.3s;
}

.remove-item-btn:hover {
    color: #dc3545;
}

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

.quantity-btn {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-color);
    background-color: var(--background-color);
    cursor: pointer;
    border-radius: 50%;
    font-weight: 600;
    color: var(--secondary-color);
    transition: background-color 0.2s, color 0.2s;
}

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

.quantity {
    margin: 0 0.75rem;
    font-weight: 500;
}

.cart-summary {
    padding-top: 1rem;
}

.cart-summary.hidden {
    display: none;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.summary-line.total {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 1rem;
}

.checkout-btn {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: background-color 0.3s ease;
}

.checkout-btn:hover {
    background-color: #0056b3;
}

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

footer h4 {
    margin-bottom: 1rem;
}

.contact-info p {
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.contact-info i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.newsletter {
    margin-top: 1.5rem;
}

.subscribe-box {
    display: flex;
}

.subscribe-box input {
    flex: 1;
    border: 1px solid var(--border-color);
    padding: 0.6rem;
    border-radius: 5px 0 0 5px;
}
.subscribe-box input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.subscribe-box button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    cursor: pointer;
    border-radius: 0 5px 5px 0;
}

/* Skeleton Loader */
.product-card.skeleton {
    cursor: default;
}
.product-card.skeleton:hover {
    transform: none;
    box-shadow: none;
}
.skeleton-img {
    width: 100%;
    height: 150px;
    background-color: #e0e0e0;
    border-radius: 5px;
    animation: pulse 1.5s infinite ease-in-out;
    margin-bottom: 1rem;
}
.skeleton-text {
    height: 1em;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin: 0.5rem auto;
    width: 80%;
    animation: pulse 1.5s infinite ease-in-out;
}
.skeleton-text.short {
    width: 50%;
}
.skeleton-btn {
    height: 38px;
    width: 120px;
    background-color: #e0e0e0;
    border-radius: 20px;
    margin: 1rem auto 0;
    animation: pulse 1.5s infinite ease-in-out;
}

/* Product Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--surface-color);
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    display: flex;
    padding: 2rem;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-color);
    line-height: 1;
}

.modal-image-container {
    flex-basis: 45%;
    padding-right: 2rem;
}

#modal-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 400px;
}

.modal-info {
    flex-basis: 55%;
}

.modal-brand {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

#modal-name {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

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

#modal-desc {
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.modal-specs h4 {
    margin-bottom: 0.75rem;
}

.modal-specs ul {
    list-style: none;
    padding-left: 0;
}

.modal-specs li {
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.modal-info .add-to-cart-btn {
    margin-top: 1.5rem;
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
}

/* Animations */
@keyframes slideInFromLeft {
    from { transform: translateX(-5%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

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

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

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

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

/* Fly to cart animation */
.flying-image {
    position: fixed;
    z-index: 1000;
    border-radius: 10px;
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.8s ease-out;
    pointer-events: none;
    background-color: var(--surface-color);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.copyright {
    font-size: 1em;
    color: #9999;
    font-weight: 100;
    text-align: center;
    font-size: small;
}

.animated-name {
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
    background: linear-gradient(270deg, #0d47a1, #42a5f5, #ffffff, #42a5f5, #0d47a1);
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: gradientMove 1.8s linear infinite;
    cursor: pointer;
}

.animated-name:hover {
    animation-play-state: paused;
}

.letter {
    display: inline-block;
    animation: none;
    transition: transform 0.3s ease;
}

.animated-name:hover .letter {
    animation: bounceUp 0.6s ease forwards;
    animation-delay: calc(var(--i) * 0.01s);
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 150% 50%; }
}