/* ===== See-through UI — Dark Theme (AI Atelier Nocturne) ===== */

:root {
    --bg-primary: #0a0a12;
    --bg-secondary: #13111c;
    --bg-card: #16162a;
    --bg-card-hover: #1e1e38;
    --border: #2a2a45;
    --border-hover: #4a4a70;
    --accent: #818cf8;
    --accent-glow: rgba(129, 140, 248, 0.15);
    --accent-soft: #a78bfa;
    --text-primary: #e0e0e8;
    --text-secondary: #888;
    --text-muted: #555;
    --success: #34d399;
    --error: #f87171;
    --warning: #fbbf24;
    --header-height: 56px;
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.header-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--accent-soft);
}

.header-title .icon { margin-right: 8px; opacity: 0.8; }

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

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error);
    transition: background 0.3s;
}

.status-dot.connected { background: var(--success); }

.btn-icon {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: border-color 0.2s, background 0.2s;
}

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

.btn-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== Main Layout ===== */
.main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    max-height: calc(100vh - var(--header-height));
    overflow: hidden;
}

.panel {
    padding: 24px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
}

.panel:last-child { border-right: none; }

.panel-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* ===== Drop Zone ===== */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.drop-zone-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.drop-zone-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.drop-zone-sub {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 6px;
}

/* ===== Preview ===== */
.preview-input {
    display: none;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    cursor: pointer;
    position: relative;
}

.preview-input img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    display: block;
}

.input-filename {
    display: none;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 8px;
    text-align: center;
}

/* ===== Settings ===== */
.settings-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 8px 0;
    margin-top: 16px;
}

.settings-toggle::after {
    content: '▸';
    transition: transform 0.2s;
}

.settings-toggle.open::after {
    transform: rotate(90deg);
}

.settings-panel {
    display: none;
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.setting-row {
    margin-bottom: 14px;
}

.setting-row:last-child { margin-bottom: 0; }

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.setting-value {
    color: var(--accent-soft);
    font-weight: 500;
}

.setting-row input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.setting-row input[type="number"] {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.setting-row label.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.setting-row input[type="checkbox"] {
    accent-color: var(--accent);
}

/* ===== Process Button ===== */
.btn-process {
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-soft));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-process:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-process:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== Progress ===== */
.progress-section {
    display: none;
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-soft));
    border-radius: 3px;
    transition: width 0.3s;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ===== Results ===== */
.result-section {
    display: none;
}

.result-preview {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--radius);
    background: var(--bg-card);
    display: block;
    margin-bottom: 16px;
}

.result-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.btn-editor {
    display: inline-flex;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-soft));
    border: none;
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    align-items: center;
    gap: 6px;
    transition: opacity 0.2s;
}

.btn-editor:hover { opacity: 0.9; }

.btn-download {
    display: none;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-download:hover {
    background: var(--accent-glow);
}

.psd-filename {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== Layer Grid ===== */
.layer-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

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

.layer-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-align: center;
}

.layer-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: repeating-conic-gradient(#1a1a2e 0% 25%, #22223a 0% 50%) 50% / 16px 16px;
}

.layer-card .layer-name {
    padding: 2px 4px 0;
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-card .layer-depth {
    padding: 0 4px 4px;
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .main {
        grid-template-columns: 1fr;
        max-height: none;
        overflow: auto;
    }
    .panel { border-right: none; border-bottom: 1px solid var(--border); }
}
