/* Linart - String Art Generator
 * A dark, elegant theme inspired by creative tools */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Outfit:wght@300;400;600&display=swap');

:root {
    --bg-deep: #0a0a0f;
    --bg-surface: #12121a;
    --bg-card: #1a1a24;
    --bg-elevated: #222230;

    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --text-dim: #555566;

    --accent: #ff6b35;
    --accent-glow: rgba(255, 107, 53, 0.3);
    --accent-secondary: #00d4aa;

    --border: #2a2a3a;
    --success: #4ade80;
    --warning: #fbbf24;

    --radius: 12px;
    --radius-sm: 6px;
}

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

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

/* App Layout */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(255, 107, 53, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 212, 170, 0.03) 0%, transparent 50%),
        var(--bg-deep);
}

/* Header */
header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 24px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent) 0%, #ff9a5a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-weight: 300;
}

.status-bar {
    margin-left: auto;
    display: flex;
    gap: 20px;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

#image-name {
    color: var(--text-secondary);
}

#timer {
    color: var(--accent-secondary);
}

#status-indicator {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    background: var(--bg-elevated);
}

#status-indicator.running {
    background: rgba(255, 107, 53, 0.2);
    color: var(--accent);
    animation: pulse 1.5s infinite;
}

#status-indicator.finished {
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Main Layout */
main {
    flex: 1;
    display: flex;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

/* Image Panel */
.image-panel {
    flex: 1;
    display: flex;
    gap: 20px;
}

.image-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-container h3 {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
}

.image-frame {
    flex: 1;
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

/* Canvases */
#target-canvas,
#result-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100%;
    max-height: 100%;
    display: none;
}

#target-canvas.visible,
#result-canvas.visible {
    display: block;
}

.placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 14px;
    border: 2px dashed var(--border);
    margin: 20px;
    border-radius: var(--radius-sm);
}

.placeholder.hidden {
    display: none;
}

/* Transform controls */
.transform-info {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--accent);
    margin-left: 8px;
}

.transform-hint {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--text-dim);
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 10px;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

.image-frame:hover .transform-hint {
    opacity: 1;
}

.image-frame.dragging {
    cursor: grabbing !important;
}

.image-frame.dragging img {
    cursor: grabbing !important;
}

#target-frame {
    cursor: grab;
}

#target-frame img {
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
}

.btn-small {
    font-size: 11px;
    padding: 6px 12px;
    margin-top: 8px;
}

/* Reset view button - fixed position to avoid layout shifts */
#btn-reset-transform {
    visibility: hidden;
    /* Reserve space even when hidden to prevent layout shifts */
}

/* Sidebar */
.sidebar {
    width: 320px;
    min-width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

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

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

.stats-grid {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
}

.stat {
    text-align: center;
    flex: 1;
    min-width: 0;
}

.stat label {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Settings */
.setting {
    display: grid;
    grid-template-columns: 90px 1fr 50px;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

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

.setting label {
    font-size: 13px;
    color: var(--text-secondary);
}

.setting .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--accent);
    text-align: right;
}

.setting button {
    padding: 4px 8px;
    font-size: 11px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.setting button:hover {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.setting button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-enhance {
    width: 100%;
    margin-top: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    border: none;
    color: white;
    font-weight: 600;
}

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

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* Buttons */
.button-row {
    display: flex;
    gap: 8px;
}

button {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover:not(:disabled) {
    background: var(--bg-card);
    border-color: var(--text-dim);
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

button.primary:hover:not(:disabled) {
    background: #ff8555;
    border-color: #ff8555;
}

.button-row button {
    flex: 1;
}

/* Footer */
footer {
    padding: 16px 24px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
}

.controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.controls button {
    min-width: 120px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-surface);
}

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

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