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

:root {
    /* Neutral, muted color palette */
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f5;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border: #e5e7eb;
    --border-hover: #d1d5db;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --success: #059669;
    --error: #dc2626;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', 'Segoe UI', 'Roboto', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Login layout */
.login-body {
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-main {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.login-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 24px 24px 28px;
    border: 1px solid var(--border);
}

.login-header {
    margin-bottom: 16px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    margin-bottom: 12px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-label {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.login-input {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.15s ease;
}

.login-input:focus {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.login-button {
    margin-top: 4px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 999px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.login-button:hover {
    background: var(--accent-hover);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo svg {
    width: 32px;
    height: 32px;
}

.logo h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.search-container {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 8px 40px 8px 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.15s ease;
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    width: 24px;
    height: 24px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.15s ease;
}

.search-clear:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.sort-select {
    padding: 8px 32px 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5L6 8L9 5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.sort-select:hover {
    border-color: var(--border-hover);
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 24px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.refresh-btn:hover {
    background: var(--accent-hover);
}

.refresh-btn:active {
    transform: scale(0.98);
}

.refresh-btn.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}


/* Persistent Notification Panel */
.persistent-notification {
    max-width: 400px !important;
    max-height: 80vh;
    overflow-y: auto;
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 12px;
}

.notification-products-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 60vh;
    overflow-y: auto;
}

.notification-product-item {
    display: flex;
    gap: 12px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.notification-product-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.notification-product-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.notification-product-info {
    flex: 1;
    min-width: 0;
}

.notification-product-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--success);
}

.notification-product-discount {
    display: inline-block;
    padding: 2px 6px;
    background: var(--error);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    margin-left: 6px;
}


/* Main Content */
.main-content {
    padding: 32px 0;
    min-height: calc(100vh - 80px);
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 20px;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Product Card */
.product-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.15s ease;
    cursor: pointer;
}

.product-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.product-card.new-product {
    border-color: var(--success);
}

.new-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 8px;
    background: var(--success);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 10;
}

.product-image-container {
    position: relative;
    width: 100%;
    padding-top: 75%;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.product-info {
    padding: 16px;
}

.product-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.product-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.product-color {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    display: block;
}

.product-pricing {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.price-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.old-price {
    font-size: 12px;
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.current-price {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.current-price.has-discount {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.final-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--success);
    letter-spacing: -0.02em;
}

.discount-badge {
    padding: 4px 8px;
    background: var(--error);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 20px;
    text-align: center;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-tertiary);
}

.empty-state h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Notification */
#notification-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notification {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: start;
    gap: 12px;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.notification-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--success);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.notification-products {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    line-height: 1.6;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.notification-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Flash effect */
.notification-flash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 150, 105, 0.05);
    pointer-events: none;
    z-index: 9999;
    animation: flash 0.6s ease;
}

@keyframes flash {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-container {
        max-width: none;
        order: 2;
    }

    .header-stats {
        flex-wrap: wrap;
        justify-content: space-between;
        order: 3;
    }

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

    #notification-container {
        left: 12px;
        right: 12px;
    }

    .notification {
        min-width: auto;
        max-width: none;
    }
}