/* ASCII Art Generator — styles.css */

:root {
    --bg: #0A0A0F;
    --panel: #10101A;
    --surface: #18182A;
    --surface2: #20203A;
    --border: #2A2A45;
    --primary: #7C3AED;
    --primary2: #A855F7;
    --success: #10B981;
    --warn: #F59E0B;
    --text: #E8E8F0;
    --muted: #6B6B90;
    --radius: 10px;
}

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

html,
body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────── */
.app-header {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

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

.logo-art {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: monospace;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
    letter-spacing: -1px;
}

.app-header h1 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}

.header-sub {
    font-size: 0.68rem;
    color: var(--muted);
    margin-top: 3px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ── App Layout ──────────────────────────────────────── */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.app-main {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

/* ── Controls Panel ──────────────────────────────────── */
.controls-panel {
    width: 260px;
    flex-shrink: 0;
    background: var(--panel);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.panel-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 12px;
    font-weight: 600;
}

.ctrl-section {
    margin-bottom: 18px;
}

.ctrl-label {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 500;
}

/* ── Drop Zone ───────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    margin-bottom: 8px;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.06);
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-content {
    pointer-events: none;
}

.drop-icon {
    font-size: 1.6rem;
    margin-bottom: 6px;
}

.drop-text {
    font-size: 0.72rem;
    color: var(--text);
}

.drop-sub {
    font-size: 0.65rem;
    color: var(--muted);
    margin-top: 4px;
}

.url-row {
    display: flex;
    gap: 4px;
}

.txt-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 7px;
    padding: 7px 10px;
    font-size: 0.75rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

.txt-input:focus {
    border-color: var(--primary);
}

.txt-input::placeholder {
    color: var(--muted);
}

.mono {
    font-family: 'Courier New', monospace;
}

/* ── Range ───────────────────────────────────────────── */
.range-input {
    width: 100%;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ── Radio Chars ─────────────────────────────────────── */
.char-options {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-bottom: 8px;
}

.radio-label {
    font-size: 0.72rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.radio-label input {
    accent-color: var(--primary);
}

/* ── Toggle ──────────────────────────────────────────── */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--muted);
    cursor: pointer;
    margin-bottom: 6px;
}

.toggle-label input {
    accent-color: var(--primary);
}

/* ── Theme Buttons ───────────────────────────────────── */
.theme-row {
    display: flex;
    gap: 4px;
}

.theme-btn {
    flex: 1;
    padding: 6px 4px;
    font-size: 0.7rem;
    cursor: pointer;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 6px;
    transition: all 0.15s;
}

.theme-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.theme-btn:hover:not(.active) {
    border-color: var(--primary);
    color: var(--text);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.18s;
    white-space: nowrap;
}

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

.btn:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #6d28d9;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
}

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

.btn-secondary:hover:not(:disabled) {
    border-color: #4B4B70;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: #4B4B70;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.72rem;
}

.w-full {
    width: 100%;
}

.action-row {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.action-row .btn {
    flex: 1;
    font-size: 0.7rem;
    padding: 6px 4px;
}

/* ── Stats ───────────────────────────────────────────── */
.stats-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    display: flex;
    justify-content: space-around;
    margin-top: 4px;
}

.stat {
    text-align: center;
}

.stat span:first-child {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary2);
}

.stat-l {
    font-size: 0.62rem;
    color: var(--muted);
}

/* ── Output Area ─────────────────────────────────────── */
.output-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.preview-strip {
    padding: 10px 14px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.preview-img-wrap {
    position: relative;
}

.source-img,
.preview-canvas {
    max-height: 80px;
    max-width: 130px;
    border-radius: 6px;
    display: block;
    border: 1px solid var(--border);
}

.preview-badge {
    position: absolute;
    bottom: 3px;
    left: 4px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.55rem;
    padding: 1px 5px;
    border-radius: 4px;
}

.convert-arrow {
    font-size: 1.3rem;
    color: var(--muted);
}

/* ── ASCII Container ─────────────────────────────────── */
.ascii-container {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 16px;
}

.ascii-container.theme-dark {
    background: #0a0a0f;
    color: #e0e0f0;
}

.ascii-container.theme-light {
    background: #f7f7ff;
    color: #1a1a2e;
}

.ascii-container.theme-matrix {
    background: #000;
    color: #00ff41;
}

.ascii-placeholder {
    color: var(--muted);
    text-align: center;
    margin: auto;
}

.placeholder-art {
    font-family: monospace;
    font-size: 1.2rem;
    line-height: 1.3;
    color: #333;
    margin-bottom: 16px;
}

.ascii-placeholder p {
    font-size: 0.82rem;
}

.ascii-output {
    font-family: 'Courier New', 'Lucida Console', monospace;
    font-size: 6px;
    line-height: 1.15;
    letter-spacing: 0;
    white-space: pre;
    width: 100%;
}

/* ── Toast ───────────────────────────────────────────── */
#toast-wrap {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toast {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.8rem;
    color: var(--text);
    max-width: 240px;
    animation: slide-in 0.2s ease;
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--success);
}

.toast.error {
    border-color: rgba(245, 158, 11, 0.4);
    color: var(--warn);
}

@keyframes slide-in {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
    .app {
        overflow: auto;
        height: auto;
    }

    .app-main {
        flex-direction: column;
    }

    .controls-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .ascii-container {
        min-height: 300px;
    }
}