/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --bg: #f5f6fa;
    --card: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --border: #dfe6e9;
    --success: #00b894;
    --error: #d63031;
    --radius: 10px;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 760px;
    margin: 0 auto;
}

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: 28px;
}

.header h1 {
    font-size: 1.6rem;
    color: var(--accent);
    margin-bottom: 4px;
}

.header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* ===== Config section ===== */
.config-section {
    background: #eef0f4;
    border: 1px dashed #b2bec3;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.config-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===== Sections ===== */
.section {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent-light);
}

/* ===== Grid layouts ===== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

/* ===== Fields ===== */
.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
}

.field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
}

.field input,
.field select,
.field textarea {
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: 0.92rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

/* Validation states */
.field input.valid,
.field select.valid,
.field textarea.valid {
    border-color: var(--success);
}

.field input.invalid,
.field select.invalid,
.field textarea.invalid {
    border-color: var(--error);
}

.field .error-msg {
    font-size: 0.78rem;
    color: var(--error);
    min-height: 1em;
}

/* ===== Checkboxes ===== */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--accent);
}

.checkbox-label a {
    color: var(--accent);
    text-decoration: underline;
}

/* ===== Actions ===== */
.actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    margin-bottom: 24px;
}

.btn-submit {
    flex: 1;
    padding: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
}

.btn-submit:hover {
    background: #5b4cd6;
}

.btn-submit:active {
    transform: scale(0.98);
}

.btn-submit:disabled {
    background: #b2bec3;
    cursor: not-allowed;
}

.btn-reset {
    padding: 12px 24px;
    background: transparent;
    color: var(--text-light);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
    font-family: inherit;
}

.btn-reset:hover {
    border-color: #999;
}

/* ===== Result block ===== */
.result-block {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 40px;
}

.result-block h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--accent);
}

.result-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.result-meta .tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
}

.tag-success {
    background: #e8f8f5;
    color: var(--success);
}

.tag-error {
    background: #fdecea;
    color: var(--error);
}

.tag-neutral {
    background: #eef0f4;
    color: var(--text-light);
}

.result-json {
    background: #2d3436;
    color: #dfe6e9;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Syntax highlighting classes */
.json-key    { color: #a29bfe; }
.json-string { color: #55efc4; }
.json-number { color: #fdcb6e; }
.json-bool   { color: #fd79a8; }
.json-null   { color: #636e72; }

/* ===== Success animation ===== */
@keyframes successPulse {
    0%   { box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.4); }
    70%  { box-shadow: 0 0 0 12px rgba(0, 184, 148, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 184, 148, 0); }
}

.form-success {
    animation: successPulse 0.8s ease-out;
    border: 2px solid var(--success);
    border-radius: var(--radius);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .grid-2, .grid-3, .config-grid {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
    }

    .container {
        padding: 0 4px;
    }
}
