:root {
    --primary: #6366F1;
    --secondary: #8B5CF6;
    --accent: #22D3EE;
    --bg-color: #0F1219;
    --panel-bg: rgba(20, 25, 35, 0.7);
    --panel-border: rgba(99, 102, 241, 0.2);
    --text-main: #F3F4F6;
    --text-muted: #9CA3AF;

    --diff-add-bg: rgba(16, 185, 129, 0.15);
    --diff-add-text: #34D399;
    --diff-add-inline: rgba(16, 185, 129, 0.4);

    --diff-del-bg: rgba(239, 68, 68, 0.15);
    --diff-del-text: #F87171;
    --diff-del-inline: rgba(239, 68, 68, 0.4);

    --radius: 12px;
    --transition: all 0.25s ease;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(34, 211, 238, 0.05) 0%, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
}

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

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

header {
    text-align: center;
    padding: 1.5rem;
    flex-shrink: 0;
}

header h1 {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.controls {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.options,
.actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 0.5rem;
}

.toggle-switch input {
    display: none;
}

.slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    transition: var(--transition);
}

.slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider::before {
    transform: translateX(20px);
}

.label-text {
    font-size: 0.95rem;
    color: var(--text-main);
}

button {
    font-family: inherit;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

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

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.icon-btn {
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.2rem;
    opacity: 0.8;
    transition: var(--transition);
}

.icon-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

.input-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 200px;
}

.pane {
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.pane-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
}

textarea {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 1rem;
    color: #D1D5DB;
    font-family: monospace;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: var(--transition);
}

textarea:focus {
    border-color: var(--primary);
}

.result-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 300px;
    padding: 1rem;
}

.result-section.hidden {
    display: none;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
}

.stats {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
}

.stat-add {
    color: var(--diff-add-text);
}

.stat-del {
    color: var(--diff-del-text);
}

.diff-viewer {
    flex: 1;
    overflow: auto;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    font-family: monospace;
    font-size: 14px;
    display: flex;
}

/* Diff structures */
.side-by-side .diff-wrap {
    display: flex;
    min-width: 100%;
}

.side-by-side .half {
    flex: 1;
    overflow-x: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.side-by-side .half:last-child {
    border-right: none;
}

.line {
    display: flex;
    min-height: 1.5em;
    white-space: pre;
}

.line-num {
    padding: 0 0.5rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    text-align: right;
    min-width: 3rem;
    user-select: none;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.line-content {
    padding: 0 0.5rem;
    flex: 1;
    word-break: break-all;
    white-space: pre-wrap;
}

.line.add {
    background: var(--diff-add-bg);
    color: var(--diff-add-text);
}

.line.del {
    background: var(--diff-del-bg);
    color: var(--diff-del-text);
}

.line.empty {
    background: rgba(0, 0, 0, 0.1);
}

/* Alignment spacer */

.inline-add {
    background: var(--diff-add-inline);
    border-radius: 2px;
}

.inline-del {
    background: var(--diff-del-inline);
    border-radius: 2px;
    text-decoration: line-through;
}

/* Inline mode wrapper */
.inline .diff-wrap {
    width: 100%;
}

.inline .line-num-left,
.inline .line-num-right {
    min-width: 2.5rem;
    padding: 0 0.5rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    text-align: right;
    user-select: none;
}

.inline .line-num-right {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 900px) {
    .input-section {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: column;
        gap: 1rem;
    }

    .app-container {
        height: auto;
        display: block;
    }

    main {
        min-height: 800px;
    }
}