:root {
    --bg-base: #f0f0f5;
    --bg-panel: #ffffff;
    --bg-panel-secondary: #fafafa;

    --border-light: #e4e4e7;
    --border-highlight: #d4d4d8;

    --text-main: #18181b;
    --text-muted: #71717a;

    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.15);

    --grad-1: #3b82f6;
    --grad-2: #8b5cf6;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
}

body.dark-theme {
    --bg-base: #09090b;
    --bg-panel: #18181b;
    --bg-panel-secondary: #27272a;

    --border-light: #27272a;
    --border-highlight: #3f3f46;

    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;

    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-glow: rgba(96, 165, 250, 0.15);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
}

svg {
    display: block;
}

.w-4 {
    width: 1rem;
}

.h-4 {
    height: 1rem;
}

.w-5 {
    width: 1.25rem;
}

.h-5 {
    height: 1.25rem;
}

.w-6 {
    width: 1.5rem;
}

.h-6 {
    height: 1.5rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.font-medium {
    font-weight: 500;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

.hidden {
    display: none !important;
}

.text-accent {
    color: var(--accent);
}

.text-gradient {
    background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Layout */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    gap: 1.5rem;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Buttons */
.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    color: var(--text-main);
    background: var(--bg-panel-secondary);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-text:hover {
    color: var(--text-main);
}

/* Workspace */
.workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
    /* Important for flex child scrolling */
}

@media (max-width: 900px) {
    .app-container {
        height: auto;
        min-height: 100vh;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .input-section {
        height: 400px;
    }
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-panel-secondary);
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.panel-actions {
    display: flex;
    gap: 1rem;
}

/* Input Area */
.input-area {
    flex: 1;
    width: 100%;
    resize: none;
    border: none;
    background: transparent;
    color: var(--text-main);
    padding: 1.25rem;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    outline: none;
}

.input-area::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.footer-stats {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-panel-secondary);
}

/* Conversions List */
.output-section {
    display: flex;
    flex-direction: column;
}

.conversions-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.conversion-card {
    background: var(--bg-panel-secondary);
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    group: hover;
}

.conversion-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-glow);
    background: var(--bg-panel);
}

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

.case-name {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
}

.copy-icon {
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

.conversion-card:hover .copy-icon {
    opacity: 1;
}

.conversion-card:active .copy-icon {
    color: var(--accent);
    transform: scale(0.9);
}

.case-output {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--text-main);
    word-break: break-all;
    white-space: pre-wrap;
    /* Preserve multi-line */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-main);
    color: var(--bg-base);
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.875rem;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}

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