/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --black: #000000;
    --white: #FFFFFF;
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #E5E5E5;
    --gray-300: #D4D4D4;
    --gray-400: #A3A3A3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    
    --accent: #FF3B30;
    --accent-hover: #FF5247;
    --success: #34C759;
    --warning: #FF9500;
    
    /* New variables for modern button style */
    --label: #1d1d1f;
    --fill: rgba(0, 0, 0, 0.06);
    --fill-hover: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--white);
    color: var(--black);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-display: swap;
}

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

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

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

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

/* Loader Styles */
.loader-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    gap: 1.5rem;
    animation: fadeIn 0.3s ease-in;
}

.loader {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--black);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* Header Styles */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-main {
    padding: 0.84rem 0;
}

.header-content {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 3rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--black);
    text-decoration: none;
}

.search-container {
    flex: 1;
    position: relative;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    height: 34px;
    padding: 0 36px 0 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: var(--gray-50);
}

.search-input:focus {
    outline: none;
    border-color: var(--black);
    background: var(--white);
}

.search-button {
    position: absolute;
    right: 1px;
    top: 1px;
    height: 32px;
    width: 32px;
    background: var(--black);
    border: none;
    border-radius: 0 7px 7px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.search-button:hover {
    background: var(--gray-800);
}

.search-button svg {
    width: 16px;
    height: 16px;
    stroke: var(--white);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.header-button {
    height: 34px;
    padding: 0 16px;
    background: transparent;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-button:hover {
    border-color: var(--black);
}

.header-button.primary {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--label);
    text-decoration: none;
    padding: 0 14px;
    min-height: 34px;
    height: 34px;
    background: var(--fill);
    border-radius: 17px;
    border: none;
    display: flex;
    align-items: center;
    transition: opacity 0.15s;
}

.header-button.primary:hover {
    background: var(--fill-hover);
    opacity: 0.8;
}

.header-button svg {
    width: 20px;
    height: 20px;
}

.cart-badge {
    background: var(--accent);
    color: var(--white);
    font-size: 0.75rem;
    padding: 0 6px;
    border-radius: 10px;
    margin-left: 4px;
}

/* Product Card Styles */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: var(--black);
}

.product-card:hover {
    border-color: var(--black);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.product-image {
    position: relative;
    width: 100%;
    height: 280px;
    background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
    overflow: hidden;
}

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

.product-body {
    padding: 1.25rem;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.product-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.product-seller {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.verified-icon {
    color: var(--success);
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.price-current {
    font-size: 1.25rem;
    font-weight: 700;
}

.product-action {
    width: 36px;
    height: 36px;
    background: var(--black);
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.product-action:hover {
    background: var(--gray-800);
    transform: scale(1.1);
}

.product-action svg {
    width: 18px;
    height: 18px;
    stroke: var(--white);
}

/* Footer Styles */
.footer {
    background: var(--black);
    color: var(--white);
    padding: 4rem 0 2rem;
}

.footer-content {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand {
    max-width: 300px;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
}

.footer-description {
    color: var(--gray-400);
    font-size: 0.875rem;
    line-height: 1.6;
}

.footer-column h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

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

.footer-links a {
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--gray-800);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-copyright {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.payment-methods {
    display: flex;
    gap: 1rem;
}

.payment-method {
    width: 40px;
    height: 24px;
    background: var(--gray-800);
    border-radius: 4px;
}

/* Section Styles */
.section {
    max-width: 1440px;
    margin: 4rem auto;
    padding: 0 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.875rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* Alert Styles */
.alert {
    position: fixed;
    top: 2rem;
    right: 2rem;
    min-width: 320px;
    padding: 1rem 1.5rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 1000;
}

.alert.show {
    display: block;
}

.alert-error {
    background: rgba(255, 59, 48, 0.95);
    border-color: var(--accent);
}

.alert-error .alert-content {
    color: var(--white);
}

.alert-success {
    background: rgba(52, 199, 89, 0.95);
    border-color: var(--success);
}

.alert-success .alert-content {
    color: var(--white);
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-message {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Mobile Responsive Styles */
@media (max-width: 1024px) {
    .header-content {
        padding: 0 1rem;
        gap: 1rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    .header-button {
        padding: 0 12px;
        font-size: 0.8rem;
    }

    .header-button svg {
        width: 18px;
        height: 18px;
    }

    .header-button .button-text {
        display: none;
    }

    .section {
        padding: 0 1rem;
        margin: 2rem auto;
    }

    .section-header {
        margin-bottom: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

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

    .product-image {
        height: 230px;
    }

    .product-body {
        padding: 1rem;
    }

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

    .product-meta {
        font-size: 0.7rem;
        gap: 0.5rem;
    }

    .product-footer {
        padding-top: 0.75rem;
    }

    .price-current {
        font-size: 1rem;
    }

    .product-action {
        width: 32px;
        height: 32px;
    }

    .product-action svg {
        width: 16px;
        height: 16px;
    }

    .footer {
        padding: 3rem 0 1.5rem;
    }

    .footer-content {
        padding: 0 1rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-brand {
        max-width: 100%;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .search-container {
        display: none;
    }

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

    .alert {
        right: 1rem;
        left: 1rem;
        min-width: auto;
    }
}