/* Listing Page - Clean Mobile-First CSS */
:root {
    --primary: #FF6B35;
    --primary-dark: #e55a2b;
    --primary-light: #fff0eb;
    --success: #4CAF50;
    --error: #f44336;
    --warning: #ff9800;
    --text: #1a1a2e;
    --text-light: #666;
    --text-muted: #999;
    --bg: #f5f5f7;
    --white: #fff;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; padding-bottom: 100px; }

/* Header */
.header { position: sticky; top: 0; background: var(--white); padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); z-index: 100; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 700; }
.logo img { width: 32px; height: 32px; border-radius: 8px; }
.header nav { display: flex; gap: 16px; }
.header nav a { color: var(--text-light); font-size: 1.1rem; }

/* Main */
.main { max-width: 600px; margin: 0 auto; padding: 16px; }

/* Seller Card */
.seller-card { display: flex; align-items: center; gap: 12px; background: var(--white); padding: 16px; border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.seller-card img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
.seller-info { flex: 1; }
.seller-info h3 { font-size: 1rem; margin-bottom: 2px; }
.seller-info p { font-size: 0.8rem; color: var(--text-muted); }
.stat { text-align: center; }
.stat span { display: block; font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.stat small { font-size: 0.7rem; color: var(--text-muted); }

/* Warning Banner */
.warning-banner { display: flex; align-items: center; gap: 10px; background: #fff3cd; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.85rem; }
.warning-banner i { color: var(--warning); }
.warning-banner a { margin-left: auto; color: var(--primary); font-weight: 600; text-decoration: none; }

/* Tabs */
.tabs { display: flex; background: var(--white); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; box-shadow: var(--shadow); }
.tab { flex: 1; padding: 14px; border: none; background: none; font-size: 0.9rem; font-weight: 500; color: var(--text-light); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s; }
.tab.active { background: var(--primary); color: var(--white); }
.tab i { font-size: 1rem; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Steps */
.steps { display: flex; justify-content: space-between; background: var(--white); padding: 16px; border-radius: var(--radius); margin-bottom: 12px; box-shadow: var(--shadow); }
.step { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; flex: 1; position: relative; }
.step span { width: 32px; height: 32px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.9rem; color: var(--text-muted); transition: all 0.3s; }
.step small { font-size: 0.7rem; color: var(--text-muted); }
.step.active span { background: var(--primary); color: var(--white); }
.step.active small { color: var(--primary); font-weight: 600; }
.step.done span { background: var(--success); color: var(--white); }
.step.done small { color: var(--success); }
.step::after { content: ''; position: absolute; top: 16px; left: 60%; width: 80%; height: 2px; background: var(--border); z-index: -1; }
.step:last-child::after { display: none; }
.step.done::after { background: var(--success); }

/* Context Pills */
.context-pills { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; padding: 4px 0; }
.context-pills:empty { display: none; }
.ctx-pill { display: flex; align-items: center; gap: 6px; background: var(--white); padding: 6px 12px; border-radius: 20px; font-size: 0.75rem; white-space: nowrap; box-shadow: var(--shadow); }
.ctx-pill img { width: 24px; height: 24px; border-radius: 4px; object-fit: cover; }
.ctx-pill span { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }

/* Form */
#listing-form { overflow: hidden; }
.form-wrapper { display: flex; transition: transform 0.3s ease; touch-action: pan-y; }
.form-step { min-width: 100%; width: 100%; flex-shrink: 0; padding: 0 2px; }
.form-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.form-card h2 { font-size: 1.1rem; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.form-card h2 i { color: var(--primary); }
.hint { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 16px; }
.pricing-help { background: var(--primary-light); padding: 12px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.pricing-help .field-desc { margin: 0; }

/* Fields */
.field { margin-bottom: 20px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.field .req { color: var(--error); }
.field-desc { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 8px; line-height: 1.4; }
.field-desc i { color: var(--primary); margin-right: 4px; }
.field input, .field textarea, .field select { width: 100%; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 1rem; background: var(--white); transition: border-color 0.2s; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--primary); }
.field small { display: block; text-align: right; font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.field.error input, .field.error select, .field.error textarea { border-color: var(--error); }
.field .error-msg { color: var(--error); font-size: 0.8rem; margin-top: 4px; }

/* Upload Area - BIGGER for mobile */
.upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 40px 20px; text-align: center; cursor: pointer; transition: all 0.2s; min-height: 140px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.upload-area:active { background: var(--primary-light); border-color: var(--primary); }
.upload-area i { font-size: 2.5rem; color: var(--primary); margin-bottom: 12px; display: block; }
.upload-area span { font-size: 1rem; color: var(--text); font-weight: 500; }
.upload-area small { font-size: 0.75rem; color: var(--text-muted); margin-top: 8px; }

/* Image Grid - BIGGER thumbnails */
.img-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.img-item { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); min-height: 100px; }
.img-item img { width: 100%; height: 100%; object-fit: cover; }
.img-item.main::before { content: 'MAIN'; position: absolute; top: 6px; left: 6px; background: var(--primary); color: var(--white); font-size: 0.65rem; padding: 3px 8px; border-radius: 4px; font-weight: 600; z-index: 2; }
.img-item .img-btns { position: absolute; bottom: 0; left: 0; right: 0; display: flex; background: rgba(0,0,0,0.6); }
.img-item .img-btns button { flex: 1; padding: 12px 8px; border: none; background: none; color: var(--white); cursor: pointer; font-size: 1rem; }
.img-item .img-btns button:active { background: rgba(255,255,255,0.1); }
.img-item .img-btns button.del:active { background: var(--error); }
.img-item.loading { display: flex; align-items: center; justify-content: center; }
.img-item.loading::after { content: ''; width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Variants */
.variant-card { background: var(--bg); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; }
.variant-head { display: flex; gap: 8px; margin-bottom: 10px; }
.variant-head select { flex: 1; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; }
.variant-head input { flex: 1; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; }
.variant-head .del-var { width: 36px; height: 36px; border: none; background: none; color: var(--error); cursor: pointer; font-size: 1rem; }

/* Compact 2-row option card */
.opt-card { background: var(--white); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 10px; position: relative; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.opt-row1 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.opt-row2 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

/* Photo button - BIGGER for mobile */
.opt-img-wrap { width: 50px; height: 50px; flex-shrink: 0; position: relative; }
.opt-img-btn { width: 50px; height: 50px; border: 2px dashed var(--border); border-radius: 8px; background: var(--bg); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 1rem; transition: all 0.15s; overflow: hidden; }
.opt-img-btn:hover, .opt-img-btn:active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.opt-img-btn.has-img { border: none; }
.opt-img-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.opt-img-btn .remove-opt-img { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; background: var(--error); color: var(--white); border: none; border-radius: 50%; font-size: 0.6rem; cursor: pointer; display: none; align-items: center; justify-content: center; }
.opt-img-wrap:hover .remove-opt-img { display: flex; }
.opt-img-input { display: none; }

/* Option name */
.opt-name-field { flex: 1; }
.opt-name-field input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; font-weight: 500; }
.opt-name-field input:focus { border-color: var(--primary); outline: none; }

/* Pack size */
.opt-pack-field { width: 70px; flex-shrink: 0; }
.opt-pack-field input { width: 100%; padding: 8px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.75rem; text-align: center; color: var(--text-muted); }
.opt-pack-field input::placeholder { font-size: 0.65rem; }
.opt-pack-field input:focus { border-color: var(--primary); outline: none; color: var(--text); }

/* Delete button */
.opt-del { width: 32px; height: 32px; border: none; background: var(--bg); border-radius: 50%; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; flex-shrink: 0; }
.opt-del:hover, .opt-del:active { color: var(--error); background: #ffebee; }

/* Field group with label */
.opt-field { display: flex; flex-direction: column; gap: 3px; }
.opt-field label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }
.opt-field input { width: 100%; padding: 8px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; text-align: center; }
.opt-field input:focus { border-color: var(--primary); outline: none; }
.opt-field input[readonly] { background: var(--bg); cursor: default; }
.opt-field .difference-display { font-weight: 600; }
.opt-field .difference-positive { color: var(--success); }
.opt-field .difference-negative { color: var(--error); }

.add-opt { padding: 10px 12px; border: 1px dashed var(--primary); border-radius: var(--radius-sm); background: none; color: var(--primary); cursor: pointer; font-size: 0.85rem; width: 100%; margin-top: 6px; font-weight: 500; }
.add-opt:active { background: var(--primary-light); }

/* Mobile tweaks for variants */
@media (max-width: 400px) {
    .opt-row2 { grid-template-columns: repeat(2, 1fr); }
    .opt-field:nth-child(4) { grid-column: span 2; }
}

/* Bulk Pricing - Enhanced */
.bulk-box { 
    margin-top: 24px; 
    border: 2px solid var(--primary-light); 
    border-radius: var(--radius); 
    background: linear-gradient(135deg, #fff5f0 0%, #ffffff 100%);
}
.bulk-box summary { 
    padding: 16px 18px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 1rem;
    display: flex; 
    align-items: center; 
    gap: 10px;
    color: var(--primary);
    background: var(--primary-light);
}
.bulk-box summary i { 
    color: var(--primary); 
    font-size: 1.1rem;
}
.bulk-box[open] summary {
    border-bottom: 1px solid rgba(255,87,34,0.2);
}
.bulk-box > div,
.bulk-box > .bulk-info-banner,
.bulk-box > .bulk-tiers-header,
.bulk-box > .bulk-example {
    padding: 14px 18px;
}
.bulk-info-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: var(--radius-sm);
    margin: 14px 18px;
    padding: 14px !important;
}
.bulk-info-icon {
    width: 48px;
    height: 48px;
    background: #2196f3;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}
.bulk-info-text strong {
    display: block;
    font-size: 0.95rem;
    color: #1565c0;
    margin-bottom: 2px;
}
.bulk-info-text span {
    font-size: 0.85rem;
    color: #1976d2;
}
.bulk-tiers-header {
    display: grid;
    grid-template-columns: 1fr 1fr 40px;
    gap: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-bottom: 8px !important;
    margin: 0 18px;
    border-bottom: 1px dashed var(--border);
}
#bulk-tiers {
    padding: 12px 18px;
}
.tier-row { 
    display: grid; 
    grid-template-columns: 1fr 1fr 40px; 
    gap: 10px; 
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.tier-row input { 
    padding: 12px 14px; 
    border: 2px solid var(--border); 
    border-radius: var(--radius-sm); 
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.tier-row input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.tier-row input::placeholder {
    color: #bdbdbd;
}
.tier-row button { 
    width: 40px; 
    height: 44px;
    border: none; 
    background: #ffebee; 
    color: #e53935; 
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}
.tier-row button:hover {
    background: #e53935;
    color: white;
}
.btn-add-tier {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 36px);
    margin: 0 18px 14px;
    padding: 12px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-add-tier:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}
.btn-add-tier i {
    font-size: 1rem;
}
.bulk-example {
    background: #fff8e1;
    border-radius: var(--radius-sm);
    margin: 0 18px 18px;
    padding: 12px 14px !important;
    font-size: 0.85rem;
    color: #f57c00;
}
.bulk-example i {
    color: #ffb300;
    margin-right: 4px;
}
.tier-input-wrapper {
    position: relative;
}
.tier-input-wrapper input {
    width: 100%;
    padding-right: 50px !important;
}
.tier-input-label {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    pointer-events: none;
    font-weight: 500;
}

/* Review */
.review-section { border-bottom: 1px solid var(--border); padding: 14px 0; }
.review-section:last-child { border: none; }
.review-section h4 { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.review-section p { font-size: 0.95rem; }
.review-imgs { display: flex; gap: 8px; flex-wrap: wrap; }
.review-imgs img { width: 50px; height: 50px; border-radius: 6px; object-fit: cover; }
.review-var { background: var(--bg); padding: 10px; border-radius: var(--radius-sm); margin-top: 8px; }
.review-var strong { font-size: 0.85rem; display: block; margin-bottom: 6px; }
.review-opt { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 4px 0; color: var(--text-light); }
.review-summary { background: var(--primary-light); padding: 16px; border-radius: var(--radius-sm); margin-top: 16px; }
.review-summary h4 { color: var(--primary); margin-bottom: 10px; }
.review-row { display: flex; justify-content: space-between; font-size: 0.9rem; padding: 4px 0; }
.review-row.total { font-weight: 600; border-top: 1px solid var(--primary); padding-top: 10px; margin-top: 6px; }

/* Buttons */
.btn-primary { padding: 14px 24px; background: var(--primary); color: var(--white); border: none; border-radius: var(--radius-sm); font-size: 0.95rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary:active { background: var(--primary-dark); }
.btn-outline { padding: 12px 20px; background: none; border: 1px solid var(--primary); color: var(--primary); border-radius: var(--radius-sm); font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; gap: 8px; width: 100%; justify-content: center; }
.btn-outline:active { background: var(--primary-light); }
.btn-text { padding: 8px 12px; background: none; border: none; color: var(--primary); cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
.btn-cancel { padding: 12px 20px; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); cursor: pointer; font-size: 0.9rem; }
.btn-danger { padding: 12px 20px; background: var(--error); color: var(--white); border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.9rem; }

/* Form Nav */
.form-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; position: sticky; bottom: 16px; background: var(--white); padding: 16px; border-radius: var(--radius); box-shadow: 0 -2px 10px rgba(0,0,0,0.1); }
.btn-back { width: 50px; height: 50px; border-radius: 50%; background: var(--bg); border: none; color: var(--text); cursor: pointer; font-size: 1.1rem; }
.btn-back:disabled { opacity: 0.3; }
.btn-next { flex: 1; padding: 14px; background: var(--primary); color: var(--white); border: none; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-next:disabled { opacity: 0.5; }
.btn-submit { flex: 1; padding: 14px; background: var(--success); color: var(--white); border: none; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 600; cursor: pointer; display: none; align-items: center; justify-content: center; gap: 8px; }

/* Listings */
.list-header { display: flex; gap: 10px; margin-bottom: 16px; }
.list-header input { flex: 1; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.9rem; background: var(--white); }
.view-btns { display: flex; background: var(--white); border-radius: var(--radius-sm); overflow: hidden; }
.view-btns button { width: 44px; height: 44px; border: none; background: none; color: var(--text-muted); cursor: pointer; }
.view-btns button.active { background: var(--primary); color: var(--white); }

.listings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.listing-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.listing-card .img { aspect-ratio: 4/3; background: var(--bg); position: relative; }
.listing-card .img img { width: 100%; height: 100%; object-fit: cover; }
.listing-card .stock-badge { position: absolute; top: 8px; right: 8px; padding: 4px 8px; border-radius: 4px; font-size: 0.7rem; background: rgba(0,0,0,0.7); color: var(--white); }
.listing-card .stock-badge.low { background: var(--warning); }
.listing-card .stock-badge.out { background: var(--error); }
.listing-card .body { padding: 12px; }
.listing-card h3 { font-size: 0.85rem; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.listing-card .meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; }
.listing-card .price { color: var(--primary); font-weight: 600; }
.listing-card .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.listing-card .actions button { flex: 1; padding: 8px 6px; border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.75rem; min-width: 60px; }
.listing-card .edit-btn { background: var(--primary-light); color: var(--primary); }
.listing-card .img-btn { background: #e3f2fd; color: #1976d2; }
.listing-card .del-btn { background: #ffebee; color: var(--error); }

.listings-grid.list-view { grid-template-columns: 1fr; }
.listings-grid.list-view .listing-card { display: flex; }
.listings-grid.list-view .listing-card .img { width: 100px; aspect-ratio: 1; }
.listings-grid.list-view .listing-card .body { flex: 1; }

.empty-box { text-align: center; padding: 60px 20px; background: var(--white); border-radius: var(--radius); }
.empty-box i { font-size: 3rem; color: var(--text-muted); margin-bottom: 16px; }
.empty-box p { color: var(--text-muted); margin-bottom: 20px; }

/* Excel Table View */
.listings-table { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg); }
.table-info { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.btn-save-all { padding: 8px 16px; background: var(--success); color: var(--white); border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
.btn-save-all:disabled { background: var(--text-muted); cursor: not-allowed; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#excel-table { width: 100%; border-collapse: collapse; min-width: 850px; }
#excel-table th { background: var(--bg); padding: 12px 10px; text-align: left; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 10; }
#excel-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
#excel-table tr:hover { background: var(--primary-light); }
#excel-table tr.modified { background: #fffde7; }
#excel-table tr.saving { opacity: 0.6; pointer-events: none; }

.col-img { width: 70px; }
.col-name { width: 130px; }
.col-desc { width: 150px; }
.col-var { width: 200px; }
.col-price { width: 80px; }
.col-stock { width: 60px; }
.col-actions { width: 100px; }

/* Image thumbnails in table */
.table-img-group { display: flex; align-items: center; gap: 4px; }
.table-img { width: 50px; height: 50px; border-radius: 6px; object-fit: cover; cursor: pointer; transition: transform 0.2s; }
.table-img:hover { transform: scale(1.05); }
.table-img-more { width: 28px; height: 28px; background: var(--bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; color: var(--text-muted); font-weight: 600; }
.table-img-btn { width: 32px; height: 32px; background: var(--primary-light); border: none; border-radius: 6px; color: var(--primary); cursor: pointer; font-size: 0.75rem; }
.table-img-btn:active { background: var(--primary); color: var(--white); }

.table-cell { position: relative; }
.table-cell-content { padding: 8px; border: 1px solid transparent; border-radius: 4px; cursor: pointer; min-height: 36px; transition: all 0.15s; word-break: break-word; }
.table-cell-content:hover { background: rgba(255, 107, 53, 0.08); border-color: var(--primary-light); }
.table-cell-content.editing { border-color: var(--primary); background: var(--white); }
.table-cell input, .table-cell textarea { width: 100%; padding: 8px; border: 1px solid var(--primary); border-radius: 4px; font-size: 0.9rem; background: var(--white); resize: none; }
.table-cell input:focus, .table-cell textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--primary-light); }
.table-cell textarea { min-height: 60px; }
.table-cell .cell-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }

/* Variations Cell */
.var-cell { min-width: 180px; }
.var-cell-content { font-size: 0.8rem; }
.var-empty { padding: 8px; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; gap: 6px; border: 1px dashed var(--border); border-radius: 4px; }
.var-empty:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.var-type-label { font-weight: 600; font-size: 0.7rem; color: var(--primary); text-transform: uppercase; margin: 6px 0 2px; padding: 2px 6px; background: var(--primary-light); border-radius: 4px; display: inline-block; }
.var-row { display: flex; gap: 4px; align-items: center; padding: 3px 0; border-bottom: 1px dashed #eee; }
.var-row:last-of-type { border: none; }
.var-name { flex: 1; font-size: 0.75rem; min-width: 50px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.var-price-input, .var-stock-input { width: 55px; padding: 3px 5px; border: 1px solid var(--border); border-radius: 3px; font-size: 0.75rem; }
.var-price-input:focus, .var-stock-input:focus { border-color: var(--primary); outline: none; }
.var-del-btn { width: 20px; height: 20px; border: none; background: #ffebee; color: var(--error); border-radius: 3px; cursor: pointer; font-size: 0.65rem; padding: 0; display: flex; align-items: center; justify-content: center; }
.var-del-btn:hover { background: var(--error); color: white; }
.var-add-btn { margin-top: 6px; padding: 4px 8px; background: var(--primary-light); border: none; color: var(--primary); border-radius: 4px; font-size: 0.7rem; cursor: pointer; display: flex; align-items: center; gap: 4px; }
.var-add-btn:hover { background: var(--primary); color: white; }

/* Variant inline editor (legacy) */
.variant-mini { font-size: 0.8rem; margin-top: 4px; }
.variant-mini-row { display: flex; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.variant-mini-row:last-child { border: none; }
.variant-mini-row span { flex: 1; }
.variant-mini-row input { width: 70px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 0.8rem; }
.variant-mini-row input:focus { border-color: var(--primary); outline: none; }

.table-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.table-actions button { width: 28px; height: 28px; border: none; border-radius: 5px; cursor: pointer; font-size: 0.75rem; }
.table-actions .btn-full-edit { background: var(--primary-light); color: var(--primary); }
.table-actions .btn-var-edit { background: #e3f2fd; color: #1976d2; }
.table-actions .btn-del { background: #ffebee; color: var(--error); }
.table-actions button:active { transform: scale(0.95); }

/* Variation Editor Modal */
.var-editor-content-wrap { max-width: 600px; width: 95%; max-height: 85vh; display: flex; flex-direction: column; }
.var-editor-body { flex: 1; overflow-y: auto; padding: 16px; }
.var-editor-types { display: flex; flex-direction: column; gap: 16px; }
.var-editor-type { background: var(--bg); border-radius: var(--radius); padding: 12px; border: 1px solid var(--border); }
.var-type-header { display: flex; gap: 8px; margin-bottom: 10px; }
.var-type-header input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 500; }
.var-type-header input:focus { border-color: var(--primary); outline: none; }
.btn-del-type { width: 36px; height: 36px; border: none; background: #ffebee; color: var(--error); border-radius: var(--radius-sm); cursor: pointer; }
.btn-del-type:hover { background: var(--error); color: white; }
.var-options-list { display: flex; flex-direction: column; gap: 8px; }
.var-option-row { display: flex; gap: 6px; align-items: center; }
.var-option-row input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; }
.var-option-row input:first-child { flex: 2; }
.var-option-row input:focus { border-color: var(--primary); outline: none; }
.var-option-row button { width: 32px; height: 32px; border: none; background: #ffebee; color: var(--error); border-radius: var(--radius-sm); cursor: pointer; flex-shrink: 0; }
.var-option-row button:hover { background: var(--error); color: white; }
.btn-add-option { padding: 8px 12px; background: var(--primary-light); border: 1px dashed var(--primary); color: var(--primary); border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; justify-content: center; }
.btn-add-option:hover { background: var(--primary); color: white; border-style: solid; }
.btn-add-type { margin-top: 12px; padding: 12px; background: #e3f2fd; border: 1px dashed #1976d2; color: #1976d2; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; justify-content: center; }
.btn-add-type:hover { background: #1976d2; color: white; border-style: solid; }

@media (max-width: 600px) {
    .table-info { font-size: 0.7rem; }
    #excel-table th, #excel-table td { padding: 6px 4px; }
    .col-desc { display: none; }
    #excel-table td:nth-child(3) { display: none; }
    .var-option-row { flex-wrap: wrap; }
    .var-option-row input { min-width: 60px; }
    .var-option-row input:first-child { flex-basis: 100%; }
}

/* Toast */
#toast-box { position: fixed; bottom: 100px; left: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--text); color: var(--white); padding: 14px 16px; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 10px; font-size: 0.9rem; animation: slideUp 0.3s ease; pointer-events: auto; }
.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.warning { background: var(--warning); }
.toast button { background: none; border: none; color: inherit; cursor: pointer; margin-left: auto; opacity: 0.7; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Loader */
#loader { position: fixed; inset: 0; background: rgba(255,255,255,0.95); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 2000; }
.spin { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
#loader p { margin-top: 16px; color: var(--text-muted); }

/* Modals */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 2000; padding: 20px; }
.modal.show { display: flex; }

/* Editor Modal */
#editor-modal { flex-direction: column; background: #000; padding: 0; }
#editor-modal.show { display: flex; }
.editor-head { display: flex; justify-content: space-between; align-items: center; padding: 16px; color: var(--white); }
.editor-head button { width: 40px; height: 40px; border: none; background: rgba(255,255,255,0.1); color: var(--white); border-radius: 50%; cursor: pointer; }
.editor-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.editor-body img { max-width: 100%; max-height: 100%; }
.editor-tools { display: flex; justify-content: center; gap: 12px; padding: 16px; }
.editor-tools button { width: 50px; height: 50px; border: none; background: rgba(255,255,255,0.1); color: var(--white); border-radius: 50%; cursor: pointer; font-size: 1.1rem; }
.editor-tools button:active { background: rgba(255,255,255,0.2); }
.editor-btns { display: flex; gap: 12px; padding: 16px; }
.editor-btns button { flex: 1; }

/* Confirm Modal */
.confirm-box { background: var(--white); border-radius: var(--radius); padding: 24px; text-align: center; max-width: 320px; width: 100%; }
.confirm-icon { width: 60px; height: 60px; border-radius: 50%; background: #ffebee; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.confirm-icon i { font-size: 1.5rem; color: var(--error); }
.confirm-icon.info { background: var(--primary-light); }
.confirm-icon.info i { color: var(--primary); }
.confirm-box h3 { margin-bottom: 8px; }
.confirm-box p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }
.confirm-btns { display: flex; gap: 12px; }
.confirm-btns button { flex: 1; }

/* Cropper overrides */
.cropper-view-box, .cropper-face { border-radius: 0; }

/* Upload Progress Container */
.upload-progress-container { 
    position: fixed; 
    bottom: 20px; 
    right: 20px; 
    max-width: 350px; 
    width: calc(100% - 40px);
    z-index: 1500; 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
}

.upload-progress-item { 
    background: var(--white); 
    border-radius: var(--radius); 
    padding: 16px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
    position: relative;
    animation: slideInRight 0.3s ease;
}

.upload-progress-item.uploading { 
    border-left: 4px solid var(--primary); 
}

.upload-progress-item.complete { 
    border-left: 4px solid var(--success); 
}

.upload-progress-item.error { 
    border-left: 4px solid var(--error); 
}

.upload-info { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 8px;
    gap: 8px;
}

.upload-name { 
    font-size: 0.9rem; 
    font-weight: 600; 
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.upload-status { 
    font-size: 0.75rem; 
    color: var(--text-muted); 
}

.upload-bar { 
    height: 4px; 
    background: var(--bg); 
    border-radius: 2px; 
    overflow: hidden;
    margin-bottom: 4px;
}

.upload-bar-fill { 
    height: 100%; 
    background: var(--primary); 
    transition: width 0.3s ease;
}

.upload-progress-item.complete .upload-bar-fill { 
    background: var(--success); 
}

.upload-progress-item.error .upload-bar-fill { 
    background: var(--error); 
}

.upload-cancel { 
    position: absolute; 
    top: 12px; 
    right: 12px; 
    width: 24px; 
    height: 24px; 
    border: none; 
    background: rgba(0,0,0,0.05); 
    border-radius: 50%; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.upload-cancel:hover { 
    background: rgba(0,0,0,0.1); 
    color: var(--text);
}

.upload-progress-item.uploading .upload-cancel { 
    display: flex; 
}

.upload-progress-item.complete .upload-cancel,
.upload-progress-item.error .upload-cancel { 
    display: none; 
}

@keyframes slideInRight { 
    from { 
        transform: translateX(100%); 
        opacity: 0; 
    } 
    to { 
        transform: translateX(0); 
        opacity: 1; 
    } 
}

/* Mobile adjustments for upload progress */
@media (max-width: 600px) {
    .upload-progress-container { 
        bottom: 10px; 
        right: 10px; 
        left: 10px;
        width: auto;
        max-width: none;
    }
}
/* Image Manager Modal */
.image-manager-content {
    background: var(--white);
    border-radius: var(--radius);
    max-width: 500px;
    width: calc(100% - 32px);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i { color: var(--primary); }

.modal-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
}

.modal-close-btn:active { background: var(--border); }

.image-manager-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.image-manager-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.manage-img-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg);
}

.manage-img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.manage-img-item.main::before {
    content: 'MAIN';
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--primary);
    color: var(--white);
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    z-index: 2;
}

.manage-img-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.manage-img-remove:hover { background: var(--error); }

.manage-img-item.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.manage-img-item.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.image-manager-add {
    text-align: center;
}

.btn-add-img {
    padding: 14px 24px;
    background: var(--primary-light);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-add-img:active {
    background: var(--primary);
    color: var(--white);
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.modal-footer button { flex: 1; }

/* Mobile adjustments for image manager */
@media (max-width: 400px) {
    .image-manager-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}