@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, #0ea5e9 0%, #2dd4bf 100%);
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #2dd4bf;
    --border: rgba(255, 255, 255, 0.1);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.15);
    --panel-bg: rgba(255, 255, 255, 0.03);
    --input-bg: rgba(15, 23, 42, 0.6);
}

* {
    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: 800px;
    height: 800px;
    background: var(--primary-gradient);
    filter: blur(160px);
    opacity: 0.07;
    border-radius: 50%;
    top: -200px;
    right: -200px;
}

.blob-2 {
    bottom: -200px;
    left: -200px;
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
}

/* ── Main Layout ── */
.tool-container {
    max-width: 1200px;
    /* Reduced from 1400px for better focus */
    margin: 2rem auto;
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: 32px;
    padding: 2.5rem;
    box-shadow: var(--shadow-premium);
    position: relative;
    z-index: 10;
}

.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
}

/* ── Editor Layout ── */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.editor-box {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-label {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.stats-badge {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent);
    background: rgba(45, 212, 191, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}

textarea {
    width: 100%;
    height: 350px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: #fff;
    padding: 1.25rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: all 0.3s;
}

textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.1);
}

/* ── Controls Panel ── */
.controls-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 2.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
}

@media (min-width: 1201px) {
    .controls-panel {
        grid-template-columns: repeat(3, 1fr);
        /* Force 3 columns on large screens for organized look */
    }
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.group-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    border-left: 4px solid var(--accent);
    padding-left: 0.75rem;
    margin-bottom: 0.5rem;
}

.input-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.input-row.full-width {
    grid-template-columns: 1fr;
}

.input-field {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: #fff;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.input-field:focus {
    border-color: var(--accent);
    background: rgba(15, 23, 42, 0.8);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    padding: 0.25rem 0;
}

.checkbox-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

.checkbox-item:hover .checkbox-label {
    color: #fff;
}

/* ── Case Buttons ── */
.btn-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn-small {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateY(-1px);
}

.btn-small.active {
    background: var(--accent);
    color: #0f172a;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(45, 212, 191, 0.3);
}

/* ── Main Action ── */
.submit-section {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.main-btn {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    padding: 1.25rem 4rem;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.3);
}

.main-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(14, 165, 233, 0.4);
}

.main-btn:active {
    transform: translateY(-1px);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 1rem 2rem;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: var(--text-secondary);
}

/* ── Responsive ── */
@media (max-width: 1200px) {
    .tool-container {
        padding: 2rem;
    }
}

@media (max-width: 1024px) {
    .editor-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    textarea {
        height: 280px;
    }

    .header h1 {
        font-size: 2.2rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .tool-container {
        border-radius: 24px;
        padding: 1.5rem;
    }

    .controls-panel {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 2.5rem;
    }

    .input-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .main-btn {
        width: 100%;
        padding: 1.1rem 2rem;
    }

    .secondary-btn {
        width: 100%;
        text-align: center;
    }

    .submit-section {
        flex-direction: column;
        gap: 1rem;
    }

    .editor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .btn-grid {
        justify-content: center;
    }
}

/* ── Utility ── */
.mt-4 {
    margin-top: 1rem;
}

.text-center {
    text-align: center;
}