/* ================================
   CSS Variables & Reset
   ================================ */
:root {
    --primary-blue: #0052CC;
    --dark-blue: #003D99;
    --light-blue: #E6F0FF;
    --accent-blue: #0066FF;
    --white: #FFFFFF;
    --text-dark: #1A1A1A;
    --text-gray: #4A4A4A;
    --text-light: #737373;
    --border-color: #E0E0E0;
    --success-green: #00875A;
    --warning-orange: #FF8B00;
    --shadow-sm: 0 2px 8px rgba(0, 82, 204, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 82, 204, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 82, 204, 0.16);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 16px;
    background-color: #F8F9FA;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    content-visibility: auto;
    contain-intrinsic-size: 400px 300px;
}

/* Image loading optimization */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

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

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ================================
   Header & Navigation
   ================================ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    transition: var(--transition);
}

.header.scrolled {
    box-shadow: var(--shadow-md);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    gap: 2rem;
}

.nav-logo a {
    text-decoration: none;
}

.nav-logo h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin: 0;
}

.nav-logo h1 span {
    color: var(--dark-blue);
    font-weight: 500;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    font-weight: 500;
    color: var(--text-dark);
    position: relative;
    padding: 0.5rem 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-blue);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.cart-icon {
    position: relative;
    padding: 0.5rem;
    background: var(--light-blue);
    border-radius: 8px;
    color: var(--primary-blue);
    transition: var(--transition);
    margin-left: auto;
}

.cart-icon:hover {
    background: var(--primary-blue);
    color: var(--white);
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-blue);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 600;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 0.5rem;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: var(--primary-blue);
    border-radius: 2px;
    transition: var(--transition);
}

/* ================================
   Shopping Cart Sidebar
   ================================ */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 420px;
    height: 100vh;
    background: var(--white);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active {
    right: 0;
}

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

.cart-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-blue);
}

.cart-close {
    padding: 0.5rem;
    color: var(--text-gray);
    transition: var(--transition);
}

.cart-close:hover {
    color: var(--primary-blue);
    transform: rotate(90deg);
}

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

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--light-blue);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--white);
}

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

.cart-item-name {
    font-weight: 600;
    color: var(--dark-blue);
    margin-bottom: 0.25rem;
}

.cart-item-condition {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-bottom: 0.5rem;
}

.cart-item-price {
    font-weight: 600;
    color: var(--primary-blue);
    font-size: 1.125rem;
}

.cart-item-remove {
    padding: 0.5rem;
    color: var(--text-gray);
    transition: var(--transition);
}

.cart-item-remove:hover {
    color: #CC0000;
}

.cart-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-gray);
}

.cart-empty svg {
    margin: 0 auto 1rem;
    color: var(--border-color);
}

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

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.total-amount {
    color: var(--primary-blue);
    font-size: 1.5rem;
}

.cart-note {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 1rem;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ================================
   Shop Header
   ================================ */
.shop-header {
    padding: 120px 0 40px;
    background: var(--white);
}

.page-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-blue);
    margin-bottom: 0.5rem;
    text-align: center;
}

.page-subtitle {
    text-align: center;
    color: var(--text-gray);
    font-size: 1.125rem;
    margin-bottom: 2.5rem;
}

.shop-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
}

.search-box input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.filter-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-select {
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-blue);
}

/* ================================
   Products Section
   ================================ */
.products-section {
    padding: 40px 0 80px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.product-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.product-image-wrapper {
    position: relative;
    width: 100%;
    height: 240px;
    background: var(--light-blue);
    overflow: hidden;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-new {
    background: var(--success-green);
    color: var(--white);
}

.badge-second-hand {
    background: var(--warning-orange);
    color: var(--white);
}

.product-info {
    padding: 1.25rem;
}

.product-category {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark-blue);
    margin-bottom: 0.5rem;
}

.product-description {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-bottom: 1rem;
    line-height: 1.5;
}

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

.product-price {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.add-to-cart-btn {
    padding: 0.625rem 1.25rem;
    background: var(--primary-blue);
    color: var(--white);
    border-radius: 6px;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.add-to-cart-btn:hover {
    background: var(--dark-blue);
    transform: translateY(-2px);
}

.add-to-cart-btn svg {
    width: 18px;
    height: 18px;
}

/* ================================
   No Results
   ================================ */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
}

.no-results svg {
    margin: 0 auto 1.5rem;
    color: var(--border-color);
}

.no-results h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    color: var(--dark-blue);
    margin-bottom: 0.5rem;
}

.no-results p {
    color: var(--text-gray);
}

/* ================================
   Info Banner
   ================================ */
.info-banner {
    background: var(--white);
    padding: 60px 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--light-blue);
    border-radius: 12px;
}

.info-item svg {
    color: var(--primary-blue);
    flex-shrink: 0;
}

.info-item h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark-blue);
    margin-bottom: 0.25rem;
}

.info-item p {
    font-size: 0.875rem;
    color: var(--text-gray);
}

/* ================================
   CTA Section
   ================================ */
.cta-section {
    padding: 80px 0;
    background: var(--primary-blue);
    color: var(--white);
}

.cta-content {
    text-align: center;
}

.cta-content h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.cta-content p {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--dark-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-white:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

.btn-full {
    width: 100%;
}

/* ================================
   Footer
   ================================ */
.footer {
    background: var(--dark-blue);
    color: var(--white);
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-section h3,
.footer-section h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-section h3 {
    font-size: 1.5rem;
}

.footer-section p,
.footer-section li {
    opacity: 0.9;
    line-height: 1.8;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a:hover {
    opacity: 1;
    color: var(--light-blue);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.developer-credit {
    font-size: 0.875rem;
}

.developer-credit a {
    color: var(--white);
    font-weight: 600;
    text-decoration: underline;
}

.developer-credit a:hover {
    color: var(--light-blue);
}

/* ================================
   Scroll to Top Button
   ================================ */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--primary-blue);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
    box-shadow: var(--shadow-md);
}

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

.scroll-top:hover {
    background: var(--dark-blue);
    transform: translateY(-4px);
}

/* ================================
   Responsive Design
   ================================ */
@media (max-width: 992px) {
    .page-title {
        font-size: 2rem;
    }

    .shop-controls {
        flex-direction: column;
    }

    .search-box {
        width: 100%;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select {
        flex: 1;
    }

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

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 73px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 73px);
        background: var(--white);
        flex-direction: column;
        padding: 2rem;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-md);
        gap: 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-link {
        display: block;
        padding: 1rem 0;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

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

    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    .nav-logo h1 {
        font-size: 1.25rem;
    }

    .cart-sidebar {
        width: 100%;
        right: -100%;
    }

    .shop-header {
        padding: 100px 0 30px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .cta-content h2 {
        font-size: 1.75rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .page-title {
        font-size: 1.75rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .filter-group {
        flex-direction: column;
    }

    .filter-select {
        width: 100%;
    }

    .scroll-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
}

/* ================================
   Accessibility
   ================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}