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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8f7f5;
    color: #333;
    line-height: 1.6;
}

header {
    background: #2c3e50;
    color: white;
    padding: 0.75rem 1.5rem;
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ecf0f1;
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    color: #ecf0f1;
    text-decoration: none;
    margin-left: 1.5rem;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #3498db;
}

.stats-badge {
    background: #8B0000;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.flash-messages {
    margin-bottom: 1rem;
}

.flash {
    padding: 1rem;
    border-radius: 25px;
    margin-bottom: 0.5rem;
}

.flash-success { background: #d4edda; color: #155724; }
.flash-error { background: #f8d7da; color: #721c24; }

.dashboard h1 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #1a1a2e;
}

.stat-label {
    color: #7f8c8d;
    text-transform: uppercase;
    font-size: 0.875rem;
}

.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    min-height: 44px;
    line-height: 1.4;
    touch-action: manipulation;
}

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

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: 40px;
    color: white !important;
}

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

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

.product-card:hover {
    transform: translateY(-4px);
}

.product-image {
    height: 200px;
    background: #ecf0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.no-image {
    color: #95a5a6;
    font-size: 1.2rem;
}

.product-info {
    padding: 1.25rem;
}

.product-info h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-size: 1rem;
}

.sku {
    color: #7f8c8d;
    font-size: 0.875rem;
}

.price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #27ae60;
    margin: 0.5rem 0;
}

.status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    text-transform: uppercase;
}

.status-available { background: #d4edda; color: #155724; }
.status-sold { background: #f8d7da; color: #721c24; }
.status-reserved { background: #fff3cd; color: #856404; }
.status-pending { background: #d1ecf1; color: #0c5460; }

.product-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 8px;
}

/* Forms */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.85rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 1rem;
    min-height: 44px;
    -webkit-appearance: none;
    appearance: none;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Product Detail */
.product-detail {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: #3498db;
    text-decoration: none;
}

.product-header {
    margin-bottom: 1.5rem;
}

.product-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 0.5rem;
}

.product-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.image-gallery img {
    max-width: 100%;
    border-radius: 25px;
    margin-bottom: 1rem;
}

.image-editor .editor-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.canvas-wrapper {
    border: 2px dashed #ddd;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

#editor-canvas {
    max-width: 100%;
    max-height: 500px;
}

.editor-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.image-thumbnails {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.image-thumbnails img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
}

.image-thumbnails img:hover {
    border-color: #3498db;
}

.image-thumb {
    width: 100px;
    text-align: center;
}

.image-thumb span {
    font-size: 0.75rem;
    color: #7f8c8d;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
    background: #ecf0f1;
    margin-top: 3rem;
}

@media (max-width: 768px) {
    /* ── Layout ── */
    header {
        padding: 0.6rem 1rem;
    }
    main {
        margin: 1rem auto;
        padding: 0 0.75rem;
    }

    /* ── Product grid: 2 columns on tablet ── */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .product-image {
        height: 160px;
    }
    .product-info {
        padding: 0.9rem;
    }
    .product-info h3 {
        font-size: 0.9rem;
    }
    .price {
        font-size: 1.2rem;
    }
    .product-actions {
        gap: 0.4rem;
    }
    .product-actions .btn-small {
        flex: 1;
        text-align: center;
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
    }

    /* ── Stats ── */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .stat-box {
        padding: 1rem;
    }
    .stat-value {
        font-size: 1.6rem;
    }

    /* ── Actions bar ── */
    .actions-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .actions-bar .btn {
        width: 100%;
        text-align: center;
    }

    /* ── Forms ── */
    .form-container {
        padding: 1.25rem;
        margin: 0;
    }
    .form-actions {
        flex-direction: column;
    }
    .form-actions .btn {
        width: 100%;
        text-align: center;
    }

    /* ── Product detail ── */
    .product-content {
        grid-template-columns: 1fr;
    }
    .product-detail {
        padding: 1.25rem;
    }

    /* ── Hamburger menu ── */
    .hamburger {
        display: flex !important;
    }
    .nav-links {
        display: none !important;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #2c3e50;
        flex-direction: column;
        padding: 0.5rem 0;
        z-index: 9999;
        box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    }
    .nav-links.open {
        display: flex !important;
    }
    .nav-links a {
        margin-left: 0 !important;
        padding: 0.9rem 1.5rem !important;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        font-size: 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    .nav-right span {
        display: none;
    }
    .stats-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

    /* ── Editor controls ── */
    .editor-controls {
        flex-wrap: wrap;
    }
}

/* ── Small phones (single column) ── */
@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .product-image {
        height: 220px;
    }
    .product-actions {
        flex-direction: row;
        justify-content: stretch;
    }
    .product-actions .btn-small {
        flex: 1;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .stat-value {
        font-size: 1.4rem;
    }
    .dashboard h1 {
        font-size: 1.25rem;
    }
    /* Keep logout visible but compact */
    .nav-right a {
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem !important;
    }
}
