/* ═══════════════════════════════════════════════════════
   CropCrop (크롭크롭) — Glassmorphism Image Editor Styles
   ═══════════════════════════════════════════════════════ */

/* ── CSS Variables: Light Theme ── */
:root {
    --bg-primary: #f0f2f8;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255,255,255,0.6);
    --bg-card-solid: #ffffff;
    --bg-card-hover: rgba(255,255,255,0.8);

    --text-primary: #1a1a2e;
    --text-secondary: #5a5f7a;
    --text-muted: #656b85;

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-dark: #4f46e5;
    --accent-bg: rgba(99,102,241,0.08);
    --accent-glow: rgba(99,102,241,0.25);
    --accent-gradient: linear-gradient(135deg, var(--accent), #a855f7);

    --success: #10b981;
    --success-bg: #ecfdf5;
    --error: #ef4444;
    --error-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --info: #3b82f6;
    --info-bg: #eff6ff;

    --border: rgba(99,102,241,0.12);
    --border-light: rgba(99,102,241,0.06);
    --border-strong: rgba(99,102,241,0.2);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow: 0 4px 16px rgba(99,102,241,0.08);
    --shadow-lg: 0 12px 32px rgba(99,102,241,0.12);
    --shadow-xl: 0 24px 64px rgba(99,102,241,0.16);

    --radius: 20px;
    --radius-sm: 12px;
    --radius-xs: 8px;

    --glass-blur: 20px;
    --glass-border: 1px solid rgba(255,255,255,0.3);

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    --font-primary: 'SUITE Variable', system-ui, -apple-system, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* ── Dark Theme ── */
[data-theme="dark"] {
    --bg-primary: #0a0a1a;
    --bg-secondary: #141428;
    --bg-card: rgba(20,20,40,0.65);
    --bg-card-solid: #181830;
    --bg-card-hover: rgba(25,25,50,0.8);

    --text-primary: #eef0f6;
    --text-secondary: #9499b8;
    --text-muted: #8385a0;

    --accent-bg: rgba(99,102,241,0.12);
    --accent-glow: rgba(99,102,241,0.3);

    --border: rgba(99,102,241,0.15);
    --border-light: rgba(99,102,241,0.08);
    --border-strong: rgba(99,102,241,0.25);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.4);
    --shadow-xl: 0 24px 64px rgba(0,0,0,0.5);

    --glass-border: 1px solid rgba(255,255,255,0.06);

    --success-bg: rgba(16,185,129,0.1);
    --error-bg: rgba(239,68,68,0.1);
    --warning-bg: rgba(245,158,11,0.1);
    --info-bg: rgba(59,130,246,0.1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Gradient Mesh Background ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 60% at 10% 20%, rgba(99,102,241,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 90% 10%, rgba(139,92,246,0.10) 0%, transparent 55%),
        radial-gradient(ellipse 70% 60% at 50% 90%, rgba(59,130,246,0.08) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 80% 60%, rgba(168,85,247,0.06) 0%, transparent 50%);
    pointer-events: none;
}

[data-theme="dark"] body::before {
    background:
        radial-gradient(ellipse 80% 60% at 10% 20%, rgba(99,102,241,0.15) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 90% 10%, rgba(139,92,246,0.12) 0%, transparent 55%),
        radial-gradient(ellipse 70% 60% at 50% 90%, rgba(59,130,246,0.10) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 80% 60%, rgba(168,85,247,0.08) 0%, transparent 50%);
}

/* ── Header ── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: var(--glass-border);
    padding: 0.5rem 1.5rem;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Theme Toggle ── */
.theme-toggle {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition);
    color: var(--text-secondary);
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(30deg);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Glass Card ── */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
}

.btn-ghost:hover {
    color: var(--accent);
    background: var(--accent-bg);
}

.btn-ghost.btn-active,
.btn-ghost.btn-active:hover {
    color: var(--accent);
    background: var(--accent-bg);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-xs);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-danger {
    background: var(--error);
    color: #fff;
    border-color: transparent;
}

.btn-danger:hover {
    background: #dc2626;
}

/* ── Landing / Hero Section ── */
.landing {
    max-width: 800px;
    margin: 3rem auto;
    padding: 0 1.5rem;
    text-align: center;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* ── Drop Zone ── */
.drop-zone {
    border: 3px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 4rem 2rem;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    position: relative;
    overflow: hidden;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-bg);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.drop-zone-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.drop-zone-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.drop-zone-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.drop-zone-btn {
    margin-top: 1rem;
}

/* ── Global Drop Overlay ── */
.global-drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(99,102,241,0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.global-drop-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.global-drop-overlay-inner {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    border: 3px dashed var(--accent);
    border-radius: var(--radius);
    padding: 3rem 4rem;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: pulse 2s ease-in-out infinite;
}

/* ── File List ── */
.file-list-section {
    max-width: 800px;
    margin: 0 auto 1.5rem;
    padding: 0 1.5rem;
}

.file-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.file-item:hover {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.file-item.active {
    border-color: var(--accent);
    background: var(--accent-bg);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.file-item.dragging {
    opacity: 0.4;
}

.file-item.drag-over-above {
    box-shadow: 0 -2px 0 0 var(--accent);
}

.file-item.drag-over-below {
    box-shadow: 0 2px 0 0 var(--accent);
}

.file-drag-handle {
    cursor: grab;
    font-size: 1.1rem;
    color: var(--text-muted);
    flex-shrink: 0;
    user-select: none;
}

.file-drag-handle:active {
    cursor: grabbing;
}

.file-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-card-hover);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.file-remove:hover {
    color: var(--error);
    background: var(--error-bg);
}

/* ── Workspace ── */
.workspace {
    display: none;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

.workspace.active {
    display: flex;
    flex-direction: column;
}

/* ── Toolbar ── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    position: relative;
    z-index: 10;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 0.5rem;
}

.toolbar-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 0.25rem;
}

/* ── Preset Selector ── */
.preset-selector {
    position: relative;
}

.preset-btn {
    min-width: 180px;
    justify-content: space-between;
}

.preset-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-card-solid);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xl);
    z-index: 200;
    display: none;
    padding: 0.5rem;
}

.preset-dropdown.open {
    display: block;
    animation: fadeSlideDown 0.2s ease;
}

.preset-search {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.preset-search:focus {
    border-color: var(--accent);
}

.preset-list {
    list-style: none;
}

.preset-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
}

.preset-item:hover {
    background: var(--accent-bg);
    color: var(--accent);
}

.preset-item.selected {
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}

.preset-item-res {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.preset-item-color {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 0.5rem;
}

.preset-item-color.color {
    background: var(--accent-gradient);
}

.preset-item-color.bw {
    background: var(--text-muted);
}

/* ── Main Layout ── */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1rem;
    align-items: start;
}

/* ── Canvas Area ── */
.canvas-wrapper {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    position: sticky;
    top: 60px;             /* below header */
    height: calc(100vh - 200px);
    min-height: 400px;
}

.canvas-wrapper canvas {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.canvas-zoom-info {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    padding: 0.3rem 0.6rem;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    border-radius: 6px;
    pointer-events: none;
}

/* ── Side Panel ── */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.panel-section {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

/* Attention pulse — toolbar button → panel focus guide */
.panel-section.panel-attention {
    animation: panelAttention 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes panelAttention {
    0%   { border-color: var(--border); box-shadow: var(--shadow); }
    30%  { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow-lg); }
    100% { border-color: var(--border); box-shadow: var(--shadow); }
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.panel-header:hover {
    background: var(--accent-bg);
}

.panel-header-icon {
    transition: transform var(--transition-fast);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.panel-section.collapsed .panel-header-icon {
    transform: rotate(-90deg);
}

.panel-body {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-light);
}

.panel-section.collapsed .panel-body {
    display: none;
}

/* ── Preview ── */
.preview-section {
    text-align: center;
}

.preview-canvas-wrap {
    background: repeating-conic-gradient(#e5e5e5 0% 25%, #fff 0% 50%) 50% / 16px 16px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .preview-canvas-wrap {
    background: repeating-conic-gradient(#2a2a3a 0% 25%, #1a1a2a 0% 50%) 50% / 16px 16px;
}

.preview-canvas-wrap canvas,
.preview-canvas-wrap img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.preview-info {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ── Filters Panel ── */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}

.filter-chip {
    padding: 0.4rem 0.3rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xs);
    font-size: 0.7rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-primary);
}

.filter-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}

.filter-chip.active {
    border-color: var(--accent);
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}

.filter-category-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0.5rem 0 0.25rem;
}

.filter-category-label:first-child {
    margin-top: 0;
}

/* ── Sliders / Range inputs ── */
.slider-group {
    margin-bottom: 0.6rem;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.slider-value {
    font-family: var(--font-mono);
    color: var(--accent);
    font-weight: 600;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 2px 6px rgba(99,102,241,0.3);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    box-shadow: 0 2px 6px rgba(99,102,241,0.3);
    cursor: pointer;
}

/* ── Tools Panel ── */
.tool-grid {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.tool-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.tool-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}

.tool-btn.active {
    border-color: var(--accent);
    background: var(--accent-bg);
    color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Tool options */
.tool-options {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
}

.tool-option-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
}

.tool-option-row label {
    flex-shrink: 0;
    width: 60px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.tool-option-row input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.tool-option-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.tool-option-row input[type="color"]::-webkit-color-swatch {
    border-radius: 3px;
    border: none;
}

.tool-option-row input[type="text"],
.tool-option-row input[type="number"],
.tool-option-row select {
    flex: 1;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.8rem;
    outline: none;
}

.tool-option-row input:focus,
.tool-option-row select:focus {
    border-color: var(--accent);
}

/* ── Color Palette ── */
.palette-display {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.palette-swatch {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    position: relative;
}

.palette-swatch:hover {
    transform: scale(1.1);
    border-color: var(--text-primary);
    z-index: 1;
}

.palette-swatch-hex {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Bottom Bar ── */
.bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.bottom-bar-left,
.bottom-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Progress Bar ── */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 0.8rem 1.25rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: toastSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    background: var(--bg-card-solid);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    color: var(--text-primary);
    max-width: 380px;
    position: relative;
    overflow: hidden;
}

.toast.removing {
    animation: toastSlideOut 0.3s ease forwards;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 50px 50px;
    animation: toastProgress linear forwards;
}

.toast-success .toast-progress { background: var(--success); }
.toast-error .toast-progress { background: var(--error); }
.toast-info .toast-progress { background: var(--info); }
.toast-warning .toast-progress { background: var(--warning); }

/* ── Export Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    animation: fadeSlideDown 0.3s ease;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ── Format selector ── */
.format-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.format-option {
    padding: 0.6rem 0.5rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
    font-weight: 600;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-primary);
}

.format-option:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.format-option.active {
    border-color: var(--accent);
    background: var(--accent-bg);
    color: var(--accent);
}

/* ── Orientation Toggle ── */
.orientation-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.orientation-toggle button {
    padding: 0.4rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 0.8rem;
    transition: all var(--transition-fast);
}

.orientation-toggle button.active {
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}

.orientation-toggle button:hover:not(.active) {
    background: var(--bg-card-hover);
}

/* ── Tooltips (JS-positioned to avoid overflow clipping) ── */
.cc-tooltip {
    position: fixed;
    padding: 6px 14px;
    background: var(--bg-card-solid);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    z-index: 9000;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.15s, transform 0.15s;
}

.cc-tooltip.visible {
    opacity: 1;
    transform: scale(1);
}

/* ── Shortcuts Bar ── */
.shortcuts-bar {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.75rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.shortcuts-bar kbd {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-card-hover);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    box-shadow: 0 1px 0 var(--border);
}

/* ── AI Loading ── */
.ai-loading {
    text-align: center;
    padding: 1.5rem;
}

.ai-loading-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 0.75rem;
}

.ai-loading-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ai-unavailable {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Composite / Collage Panel ── */
.composite-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ── Batch Progress ── */
.batch-progress {
    padding: 1rem;
}

.batch-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
}

.batch-item-status {
    width: 18px;
    text-align: center;
}

/* ── Animations ── */
@keyframes toastSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-10px) scale(0.95); }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ── Selection ── */
::selection {
    background: var(--accent-bg);
    color: var(--accent);
}

/* ── Hidden utility ── */
.hidden {
    display: none !important;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }

    .canvas-wrapper {
        position: relative;
        top: auto;
        height: 50vh;
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 0.5rem 0;
    }

    .logo-sub {
        display: none;
    }

    .landing {
        margin: 1.5rem auto;
        padding: 0 1rem;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .drop-zone {
        padding: 2.5rem 1rem;
    }

    .toolbar {
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .preset-btn {
        min-width: 140px;
        font-size: 0.8rem;
    }

    .preset-dropdown {
        width: 280px;
    }

    .bottom-bar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .shortcuts-bar {
        display: none;
    }

    .cc-tooltip {
        display: none;
    }

    .format-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .header-inner {
        padding: 0.5rem 0.25rem;
    }

    .logo-text {
        font-size: 1rem;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .file-list-section {
        padding: 0 0.75rem;
    }

    .workspace {
        padding: 0 0.5rem 1rem;
    }
}

/* ── Accessibility ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Focus visible ── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── Print ── */
@media print {
    .header, .toolbar, .bottom-bar, .side-panel,
    .shortcuts-bar, .toast-container { display: none !important; }
    .canvas-wrapper { border: none; box-shadow: none; }
}
