/* ============================================
   Image Placeholder Generator — Design System
   ============================================ */
:root {
    --bg-primary: #0c0e14;
    --bg-secondary: #161925;
    --bg-card: rgba(22, 25, 37, 0.85);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-primary: #e8ecf0;
    --text-secondary: #8892a4;
    --text-muted: #5b6478;
    --accent: #6366f1;
    --accent-2: #ec4899;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --success: #4ade80;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, sans-serif;
}

[data-theme="light"] {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --border-glass: rgba(0, 0, 0, 0.08);
    --text-primary: #1a1f36;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse 500px 400px at 30% 20%, rgba(99, 102, 241, 0.06), transparent 70%),
        radial-gradient(ellipse 400px 300px at 70% 70%, rgba(236, 72, 153, 0.04), transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.app {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

.header {
    padding: 16px 0 8px;
}

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

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

.logo-icon {
    font-size: 1.5rem;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: var(--radius);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.logo h1 {
    font-size: 1.05rem;
    font-weight: 700;
}

.tagline {
    font-size: 0.64rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.icon-btn:hover {
    color: var(--accent);
}

.icon {
    width: 18px;
    height: 18px;
}

.moon-icon {
    display: none;
}

[data-theme="light"] .sun-icon {
    display: none;
}

[data-theme="light"] .moon-icon {
    display: block;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.76rem;
}

.section {
    margin-bottom: 20px;
}

.section h2 {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.section h3 {
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

/* Upload */
.upload-zone {
    padding: 32px;
    background: var(--bg-card);
    border: 2px dashed var(--border-glass);
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Preview */
.preview-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 10px;
}

.preview-card h3 {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.preview-img-wrap {
    aspect-ratio: 16/10;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.preview-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-img-wrap canvas {
    width: 100%;
    height: 100%;
}

/* Type Tabs */
.type-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.type-tab {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.type-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.info-bar {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Code */
.code-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 0;
}

.code-tab {
    padding: 6px 14px;
    border: 1px solid var(--border-glass);
    border-bottom: none;
    background: var(--bg-card);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.code-tab.active {
    color: var(--accent);
    border-color: var(--accent);
}

.code-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 0 var(--radius) var(--radius) var(--radius);
    padding: 10px 14px;
}

.code-output {
    font-family: monospace;
    font-size: 0.74rem;
    color: var(--accent);
    line-height: 1.5;
    white-space: pre-wrap;
    margin: 0 0 8px;
}

/* History */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.history-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition);
}

.history-item:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.empty-msg {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    padding: 16px;
    grid-column: 1 / -1;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.82rem;
    opacity: 0;
    transition: all 0.35s ease;
    z-index: 100;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hidden {
    display: none !important;
}

@media (max-width: 480px) {
    .preview-row {
        grid-template-columns: 1fr;
    }
}