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

body {
    font-family: 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* Prevent zoom on mobile and fix overflow */
@media (max-width: 768px) {
    html {
        width: 100vw;
        max-width: 100vw;
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        -webkit-overflow-scrolling: touch;
    }
    
    body {
        width: 100vw;
        max-width: 100vw;
        overflow-x: hidden;
        margin: 0;
        padding: 0;
        -webkit-overflow-scrolling: touch;
    }
    
    .container {
        width: 100vw;
        max-width: 100vw;
        padding: 0 10px;
        margin: 0;
        box-sizing: border-box;
    }
    
    /* Ensure all elements respect viewport width */
    * {
        max-width: 100vw;
        box-sizing: border-box;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Header */
.header {
    background: #000000;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

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

.logo-icon {
    background: white;
    color: black;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.2;
    min-width: 80px;
    min-height: 60px;
    border: 2px solid #333;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.nav {
    display: none;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

.nav-link:hover {
    opacity: 0.8;
}

/* Main Content */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.content-wrapper {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
}

/* Sidebar */
.sidebar {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: fit-content;
}

.filter-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2rem;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.filter-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.reset-filter {
    width: 100%;
    padding: 10px;
    background: #000000;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    margin-bottom: 10px;
}

.reset-filter:hover {
    background: #333333;
}

.refresh-data {
    width: 100%;
    padding: 10px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.refresh-data:hover {
    background: #0056b3;
}

.refresh-data:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.refresh-data i {
    font-size: 12px;
}

.debug-data {
    width: 100%;
    padding: 8px;
    background: #ffc107;
    color: #212529;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}

.debug-data:hover {
    background: #e0a800;
}

.debug-data i {
    font-size: 10px;
}

.migrate-data {
    width: 100%;
    padding: 8px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.migrate-data:hover {
    background: #218838;
}

.migrate-data:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.migrate-data i {
    font-size: 10px;
}

/* Products Section */
.products {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.view-controls {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.view-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}

.view-btn.active,
.view-btn:hover {
    background: #000000;
    color: white;
    border-color: #000000;
}

.product-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Product Card */
.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.product-image {
    width: 100%;
    height: 250px;
    object-fit: contain;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.product-info {
    padding: 15px;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.product-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: #e74c3c;
    margin-bottom: 15px;
}

.product-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #000000;
    color: white;
}

.btn-primary:hover {
    background: #333333;
}

.btn-outline {
    background: transparent;
    color: #000000;
    border: 1px solid #000000;
}

.btn-outline:hover {
    background: #000000;
    color: white;
}

/* Footer */
.footer {
    background: #000000;
    color: white;
    padding: 2rem 0 1rem;
    margin-top: 3rem;
}

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

.footer-section h4 {
    margin-bottom: 15px;
    color: white;
}

.footer-section p {
    color: #f8f9fa;
    line-height: 1.6;
}

.footer-section a {
    color: #f8f9fa;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.footer-section i {
    margin-right: 8px;
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #333333;
    color: #f8f9fa;
}

/* Responsive */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 220px 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .sidebar {
        order: 1;
        margin: 0 10px;
    }
    
    .products {
        order: 2;
        margin: 0 10px;
    }
    
    .header .container {
        flex-direction: row;
        justify-content: center;
        gap: 10px;
        padding: 10px 15px;
    }
    
    .header {
        padding: 0.8rem 0;
    }
    
    .logo {
        gap: 10px;
    }
    
    .logo-icon {
        padding: 10px 15px;
        min-width: 60px;
        min-height: 45px;
        font-size: 14px;
    }
    
    .logo h1 {
        font-size: 1.4rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 15px;
    }
    
    .main {
        padding: 1.5rem 0;
    }
    
    .container {
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .container {
        padding: 0 8px;
        width: 100%;
        max-width: 100%;
    }
    
    .header .container {
        padding: 8px 8px;
    }
    
    .logo {
        gap: 8px;
    }
    
    .logo-icon {
        padding: 8px 12px;
        min-width: 50px;
        min-height: 40px;
        font-size: 12px;
    }
    
    .logo h1 {
        font-size: 1.2rem;
    }
    
    .main {
        padding: 1rem 0;
    }
    
    .sidebar {
        padding: 15px;
        margin: 0 8px;
        width: calc(100% - 16px);
    }
    
    .products {
        margin: 10px 8px 0 8px;
        width: calc(100% - 16px);
    }
    
    .view-controls {
        padding: 15px;
    }
    
    .product-card {
        width: 100%;
        max-width: 100%;
    }
}
/* Status Overlay Watermark */
.product-image-container {
    position: relative;
    overflow: hidden;
}

.status-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    background: rgba(220, 53, 69, 0.9);
    color: white;
    padding: 8px 20px;
    font-weight: bold;
    font-size: 16px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}

.status-overlay.sold {
    background: rgba(220, 53, 69, 0.9);
}

/* Disable interaction for sold items */
.product-card.sold .product-image {
    filter: grayscale(30%);
    opacity: 0.8;
    cursor: not-allowed;
}

.product-card.sold .btn-primary:disabled,
.product-card.sold .btn-outline:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.product-card.sold .btn-outline:disabled {
    background-color: transparent;
    color: #6c757d;
}

/* Hover effects */
.status-overlay {
    transition: all 0.3s ease;
}

.product-card:hover .status-overlay {
    transform: translate(-50%, -50%) rotate(-15deg) scale(1.05);
}

/* Disable hover for sold items */
.product-card.sold:hover .product-image {
    transform: none;
}

/* Refresh Messages */
.refresh-message {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    border-left: 4px solid #007bff;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.refresh-message.success {
    border-left-color: #28a745;
    background: #d4edda;
    color: #155724;
}

.refresh-message.error {
    border-left-color: #dc3545;
    background: #f8d7da;
    color: #721c24;
}

.refresh-message.warning {
    border-left-color: #ffc107;
    background: #fff3cd;
    color: #856404;
}

/* Mobile Header Adjustments */
@media (max-width: 768px) {
    .header {
        width: 100vw;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .header .container {
        width: 100vw;
        max-width: 100vw;
        padding: 0 10px;
        margin: 0;
        box-sizing: border-box;
        justify-content: center;
    }
    
    .logo {
        gap: 10px;
        max-width: 100%;
        overflow: hidden;
    }
    
    .logo-icon {
        padding: 10px 15px;
        min-width: 70px;
        min-height: 50px;
        font-size: 14px;
        flex-shrink: 0;
    }
    
    .logo h1 {
        font-size: 1.4rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 120px);
    }
}

@media (max-width: 480px) {
    .header .container {
        padding: 0 5px;
    }
    
    .logo {
        gap: 8px;
    }
    
    .logo-icon {
        padding: 8px 12px;
        min-width: 60px;
        min-height: 45px;
        font-size: 12px;
    }
    
    .logo h1 {
        font-size: 1.2rem;
        max-width: calc(100vw - 100px);
    }
}

@media (max-width: 360px) {
    .header .container {
        padding: 0 3px;
    }
    
    .logo {
        gap: 6px;
    }
    
    .logo-icon {
        padding: 6px 10px;
        min-width: 55px;
        min-height: 40px;
        font-size: 11px;
    }
    
    .logo h1 {
        font-size: 1.1rem;
        max-width: calc(100vw - 85px);
    }
}
/* Mobile Footer Adjustments */
@media (max-width: 768px) {
    .footer {
        width: 100vw;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .footer .container {
        width: 100vw;
        max-width: 100vw;
        padding: 0 10px;
        margin: 0;
        box-sizing: border-box;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .footer-section {
        max-width: 100%;
        overflow: hidden;
    }
    
    .footer-section h4 {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .footer-section p {
        font-size: 0.9rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .footer-bottom {
        text-align: center;
        padding: 10px 0;
        border-top: 1px solid #333;
        margin-top: 15px;
    }
    
    .footer-bottom p {
        font-size: 0.8rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

@media (max-width: 480px) {
    .footer .container {
        padding: 0 5px;
    }
    
    .footer-section h4 {
        font-size: 0.9rem;
    }
    
    .footer-section p {
        font-size: 0.8rem;
    }
    
    .footer-bottom p {
        font-size: 0.7rem;
    }
}
/* Lazy Loading Styles */
.lazy-load {
    opacity: 0.6;
    transition: opacity 0.3s ease-in-out;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.lazy-loaded {
    opacity: 1;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0.6;
    }
    to {
        opacity: 1;
    }
}

/* Image optimization loading state */
.product-image {
    transition: all 0.3s ease;
}

.product-image.lazy-load {
    filter: blur(2px);
}

.product-image.lazy-loaded {
    filter: none;
}