@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --bg-color: #0d1117;
    --card-bg: rgba(22, 27, 34, 0.8);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent: #10b981;
    --border: rgba(48, 54, 61, 0.8);
    --input-bg: rgba(13, 17, 23, 0.6);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 2rem;
    overflow-x: hidden;
}

/* ── Background Blobs ── */
.bg-blobs {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.blob {
    position: absolute;
    width: 600px;
    height: 600px;
    background: var(--primary-gradient);
    filter: blur(140px);
    opacity: 0.1;
    border-radius: 50%;
    top: -100px;
    right: -100px;
}

.blob-2 {
    bottom: -100px;
    left: -100px;
    background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
}

/* ── Container ── */
.tool-container {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
}

.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
}

/* ── Mode Selector ── */
.mode-selector-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.mode-btn {
    padding: 0.75rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.mode-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* ── Editor Layout ── */
.editor-layout {
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
}

.editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.char-count {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
}

textarea {
    width: 100%;
    height: 300px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: #fff;
    padding: 1.25rem;
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.action-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.divider-line {
    width: 1px;
    flex: 1;
    background: var(--border);
}

.divider-icon {
    font-size: 1.5rem;
    color: var(--accent);
    opacity: 0.5;
}

/* ── Controls ── */
.controls-card {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.extra-options {
    display: flex;
    gap: 2rem;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.toggle-switch input {
    display: none;
}

.slider {
    width: 40px;
    height: 20px;
    background: #30363d;
    border-radius: 20px;
    position: relative;
    transition: 0.3s;
}

.slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: 0.3s;
}

input:checked+.slider {
    background: var(--accent);
}

input:checked+.slider::before {
    transform: translateX(20px);
}

.main-buttons {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.9rem 2rem;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
}

.btn-secondary:hover {
    color: #fff;
    border-color: #8b949e;
}

.mini-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.mini-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .editor-layout {
        flex-direction: column;
    }

    .action-divider {
        display: none;
    }

    .mode-selector-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .tool-container {
        padding: 1.5rem;
    }

    .controls-card {
        flex-direction: column;
        gap: 1.5rem;
        align-items: stretch;
    }

    .extra-options {
        flex-direction: column;
        gap: 1rem;
    }
}