.ch-jf-container {
    background-color: #FFFFFF;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #E5E7EB;
    max-width: 1200px;
    width: 100%;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.025);
    box-sizing: border-box;
}

/* Force visible text styles specifically inside the namespaced editors overriding global styles */
{{WRAPPER}} textarea.ch-jf-editor-textarea {
    min-height: 250px;
    color: #0F172A !important;
    -webkit-text-fill-color: #0F172A !important;
    opacity: 1 !important;
    visibility: visible !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    caret-color: #2563EB !important;
    background-color: #F8FAFC !important;
    text-shadow: none !important;
    mix-blend-mode: normal !important;
    filter: none !important;
    box-sizing: border-box;
}

{{WRAPPER}} textarea.ch-jf-editor-textarea::selection {
    background-color: rgba(37, 99, 235, 0.18) !important;
    color: #0F172A !important;
    -webkit-text-fill-color: #0F172A !important;
    text-shadow: none !important;
}

{{WRAPPER}} textarea.ch-jf-editor-textarea::placeholder {
    color: #64748B !important;
    -webkit-text-fill-color: #64748B !important;
    opacity: 1 !important;
}

/* Suggested Fix Textarea style overrides */
{{WRAPPER}} .ch-jf-suggest-textarea {
    min-height: 120px !important;
    height: 120px !important;
}

.ch-jf-focus:focus-visible {
    outline: 2px solid #2563EB;
    outline-offset: 2px;
}

.ch-jf-status-badge {
    transition: all 0.2s ease;
}

.ch-jf-status-ready {
    color: #334155;
    background-color: #F8FAFC;
    border-color: #E5E7EB;
}

.ch-jf-status-valid {
    color: #15803D;
    background-color: rgba(21, 128, 61, 0.1);
    border-color: #15803D;
}

.ch-jf-status-invalid {
    color: #DC2626;
    background-color: rgba(220, 38, 38, 0.1);
    border-color: #DC2626;
}

/* Button styles */
.ch-jf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.ch-jf-btn-primary {
    background-color: #2563EB;
    color: #FFFFFF;
}

.ch-jf-btn-primary:hover {
    background-color: #1D4ED8;
}

.ch-jf-btn-primary:focus-visible {
    outline-color: #2563EB;
}

.ch-jf-btn-secondary {
    background-color: #0F766E;
    color: #FFFFFF;
}

.ch-jf-btn-secondary:hover {
    background-color: #0D5F58;
}

.ch-jf-btn-secondary:focus-visible {
    outline-color: #0F766E;
}

/* Target Minify specifically with sufficient wrapper CSS specificity */
{{WRAPPER}} .ch-jf-toolbar .ch-jf-btn-minify,
{{WRAPPER}} .ch-jf-toolbar button.ch-jf-btn-minify {
    background-color: #334155 !important;
    color: #FFFFFF !important;
}

{{WRAPPER}} .ch-jf-toolbar .ch-jf-btn-minify:hover,
{{WRAPPER}} .ch-jf-toolbar button.ch-jf-btn-minify:hover {
    background-color: #1E293B !important;
    color: #FFFFFF !important;
}

.ch-jf-btn-copy:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #9CA3AF !important;
}

/* Responsive Queries for Toolbar and Grid */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    /* For tablet viewport: 12-column grid to manage specific item distribution */
    {{WRAPPER}} .ch-jf-toolbar {
        display: grid !important;
        grid-template-columns: repeat(12, 1fr) !important;
        gap: 12px !important;
        width: 100% !important;
    }
    
    /* Clear out tablet custom inline row wrappers if present, or override flex behavior */
    {{WRAPPER}} .ch-jf-toolbar .ch-jf-tablet-row {
        display: contents !important;
    }

    /* Force spacer helper to not take grid layout space */
    {{WRAPPER}} .ch-jf-toolbar .ch-jf-spacer {
        display: none !important;
    }

    /* Row 1 placement: Format JSON, Validate, Minify evenly across 12 cols (each 4 cols) */
    {{WRAPPER}} .ch-jf-toolbar .ch-jf-btn-format {
        grid-column: span 4 !important;
        width: 100% !important;
    }
    {{WRAPPER}} .ch-jf-toolbar .ch-jf-btn-validate {
        grid-column: span 4 !important;
        width: 100% !important;
    }
    {{WRAPPER}} .ch-jf-toolbar .ch-jf-btn-minify {
        grid-column: span 4 !important;
        width: 100% !important;
    }

    /* Row 2 placement: Load Sample, Clear, Copy Output, Indent evenly across 12 cols (each 3 cols) */
    {{WRAPPER}} .ch-jf-toolbar .ch-jf-btn-sample {
        grid-column: span 3 !important;
        width: 100% !important;
    }
    {{WRAPPER}} .ch-jf-toolbar .ch-jf-btn-clear {
        grid-column: span 3 !important;
        width: 100% !important;
    }
    {{WRAPPER}} .ch-jf-toolbar .ch-jf-btn-copy {
        grid-column: span 3 !important;
        width: 100% !important;
    }
    {{WRAPPER}} .ch-jf-toolbar .ch-jf-indent-container {
        grid-column: span 3 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        width: 100% !important;
        white-space: nowrap !important;
    }
}

@media screen and (max-width: 767px) {
    .ch-jf-editors-grid {
        grid-template-columns: 1fr !important;
    }
    .ch-jf-toolbar {
        flex-direction: column;
        align-items: stretch !important;
    }
    .ch-jf-toolbar > * {
        width: 100%;
    }
    .ch-jf-toolbar .ch-jf-btn, 
    .ch-jf-toolbar .ch-jf-select {
        text-align: center;
        justify-content: center;
    }
    .ch-jf-toolbar div[style*="flex-grow: 1"] {
        display: none !important;
    }
}
