/* ─── POD-Engine — Design System ─── */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --bg-input: #1a1a25;
    --border: #2a2a3a;
    --border-hover: #3a3a4f;
    --text-primary: #e8e8f0;
    --text-secondary: #8888a0;
    --text-muted: #5a5a72;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-glow: rgba(124, 58, 237, 0.15);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --cyan: #06b6d4;
    --pink: #ec4899;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── Layout ─── */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--pink));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-section { padding: 12px 8px; flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-item.active svg { stroke: var(--accent); }

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 24px 32px;
    max-width: calc(100vw - 240px);
}

/* ─── Section ─── */
.section { display: none; }
.section.active { display: block; animation: fadeIn 0.3s ease; }

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

.section-header { margin-bottom: 24px; }
.section-header h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.section-subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

/* ─── Stats Grid ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.stat-value { font-size: 26px; font-weight: 800; display: block; }
.stat-label { font-size: 13px; color: var(--text-secondary); }

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ─── Product Grid (Catalog) ─── */
.niche-section { margin-bottom: 32px; }

.niche-header {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.niche-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 20px;
    background: var(--accent-glow);
    color: var(--accent);
}

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

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.product-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.15);
}

.product-card-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.product-card-image .placeholder {
    font-size: 48px;
    color: var(--text-muted);
}

.product-card-body { padding: 14px; }

.product-card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.product-card-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.meta-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--cyan) 15%, transparent);
    color: var(--cyan);
}

.meta-badge.layers { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
.meta-badge.cliparts { background: color-mix(in srgb, var(--pink) 15%, transparent); color: var(--pink); }

/* ─── Customizer ─── */
.customizer-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    min-height: 600px;
}

.preview-area {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
}

.preview-canvas-container {
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1;
    position: relative;
}

.preview-canvas-container canvas {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
}

.mockup-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.mockup-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-xs);
    border: 2px solid var(--border);
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
}

.mockup-thumb:hover, .mockup-thumb.active { border-color: var(--accent); }
.mockup-thumb img { width: 100%; height: 100%; object-fit: cover; }

.options-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 8px;
}

.option-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.option-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-input:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.color-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.color-swatch:hover, .color-swatch.active {
    border-color: var(--text-primary);
    transform: scale(1.15);
}

.font-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.font-option {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    overflow: hidden;
}

.font-option:hover { border-color: var(--border-hover); }
.font-option.active { border-color: var(--accent); background: var(--accent-glow); }

.font-option img {
    width: 100%;
    height: 40px;
    object-fit: contain;
    filter: brightness(0.8);
}

.clipart-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.clipart-option {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
    padding: 4px;
}

.clipart-option:hover { border-color: var(--border-hover); }
.clipart-option.active { border-color: var(--accent); background: var(--accent-glow); }
.clipart-option img { width: 100%; height: 100%; object-fit: contain; }

/* ─── Buttons ─── */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--pink));
    color: white;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3); }

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); }

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-sm); }

.action-bar {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* ─── Back button ─── */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 16px;
    transition: var(--transition);
}
.back-btn:hover { color: var(--text-primary); }

/* ─── Loading ─── */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ─── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 13px;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow);
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }

/* ─── Empty state ─── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}
