/* Tool Hero Styles - Required */
.tool-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.hero-text {
    flex: 1;
    min-width: 260px;
}

.hero-text h1 {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 640px;
    margin-bottom: 1rem;
    margin-top: 0;
}

@media (max-width: 767px) {
    .hero-text h1 {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
    }
    
    .hero-subtitle {
        font-size: clamp(1rem, 3vw, 1.125rem);
    }
}

/* JSON to SQL Converter Styles */
:root {
    --sql-primary: #2563eb;
    --sql-primary-hover: #1d4ed8;
    --sql-primary-light: #3b82f6;
    --sql-surface: #ffffff;
    --sql-surface-alt: #f8fafc;
    --sql-border: #e2e8f0;
    --sql-border-focus: #2563eb;
    --sql-text: #0f172a;
    --sql-text-muted: #64748b;
    --sql-text-light: #94a3b8;
    --sql-success: #10b981;
    --sql-error: #ef4444;
    --sql-warning: #f59e0b;
    --sql-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --sql-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --sql-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --sql-radius: 16px;
    --sql-radius-sm: 8px;
    --sql-radius-lg: 20px;
    --sql-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sql-converter-interface {
    margin-bottom: 3rem;
}

.converter-wrapper {
    background: var(--sql-surface);
    border: 1px solid var(--sql-border);
    border-radius: var(--sql-radius-lg);
    box-shadow: var(--sql-shadow-lg);
    overflow: hidden;
    transition: var(--sql-transition);
}

.converter-wrapper:hover {
    box-shadow: 0 12px 40px rgba(37, 99, 235, 0.08);
}

/* Options Panel */
.options-panel {
    background: var(--sql-surface-alt);
    border-bottom: 1px solid var(--sql-border);
    padding: 1.5rem;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    align-items: end;
}

.option-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-field.checkbox-field {
    justify-content: center;
    align-items: flex-start;
    padding-bottom: 1rem;
}

.option-label {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sql-text);
    margin-bottom: 0;
}

.label-text {
    display: block;
}

.option-input,
.option-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    color: var(--sql-text);
    background: var(--sql-surface);
    border: 1.5px solid var(--sql-border);
    border-radius: var(--sql-radius-sm);
    transition: var(--sql-transition);
}

.option-input:focus,
.option-select:focus {
    outline: none;
    border-color: var(--sql-border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.option-input::placeholder {
    color: var(--sql-text-light);
}

.option-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.9375rem;
    color: var(--sql-text);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--sql-primary);
    flex-shrink: 0;
}

.checkbox-text {
    font-weight: 500;
}

/* Converter Grid */
.converter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 500px;
}

.input-section,
.output-section {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.input-section {
    border-right: 1px solid var(--sql-border);
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: var(--sql-surface);
    border-bottom: 1px solid var(--sql-border);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--sql-text);
    margin: 0;
}

.section-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    background: var(--sql-surface-alt);
    color: var(--sql-text-muted);
    white-space: nowrap;
}

.section-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--sql-success);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--sql-border);
    border-radius: var(--sql-radius-sm);
    color: var(--sql-text-muted);
    cursor: pointer;
    transition: var(--sql-transition);
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--sql-surface-alt);
    border-color: var(--sql-border-focus);
    color: var(--sql-primary);
}

.icon-btn:active {
    transform: scale(0.95);
}

.icon-btn svg {
    display: block;
}

/* Editor Box */
.editor-box {
    flex: 1;
    position: relative;
    min-height: 500px;
    background: var(--sql-surface);
}

.code-editor {
    width: 100%;
    height: 100%;
    min-height: 500px;
    font-size: 14px;
    line-height: 1.6;
}

/* Section Footer */
.section-footer {
    padding: 0.875rem 1.5rem;
    background: var(--sql-surface-alt);
    border-top: 1px solid var(--sql-border);
}

.footer-text {
    font-size: 0.8125rem;
    color: var(--sql-text-muted);
}

/* ACE Editor Customization */

/* JSON Editor Theme */
#jsonEditor {
    background: var(--sql-surface);
}

.ace-xcode .ace_content {
    background: var(--sql-surface);
}

.ace-xcode .ace_gutter {
    background: var(--sql-surface-alt);
    border-right: 1px solid var(--sql-border);
}

.ace-xcode .ace_variable {
    color: #2563eb;
}

.ace-xcode .ace_string {
    color: #059669;
}

.ace-xcode .ace_constant.ace_numeric {
    color: #dc2626;
}

.ace-xcode .ace_boolean {
    color: #7c3aed;
}

.ace-xcode .ace_keyword {
    color: #ea580c;
}

/* SQL Editor Theme */
#sqlEditor {
    background: var(--sql-surface-alt);
}

.ace-tomorrow {
    background: var(--sql-surface-alt);
}

.ace-tomorrow .ace_content {
    background: var(--sql-surface-alt);
}

.ace-tomorrow .ace_gutter {
    background: var(--sql-surface);
    border-right: 1px solid var(--sql-border);
}

.ace-tomorrow .ace_keyword {
    color: #2563eb;
    font-weight: 600;
}

.ace-tomorrow .ace_string {
    color: #059669;
}

.ace-tomorrow .ace_constant.ace_numeric {
    color: #dc2626;
}

.ace-tomorrow .ace_comment {
    color: var(--sql-text-light);
    font-style: italic;
}

.ace-tomorrow .ace_error,
.ace-tomorrow .ace_warning {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .converter-grid {
        grid-template-columns: 1fr;
    }

    .input-section {
        border-right: none;
        border-bottom: 1px solid var(--sql-border);
    }

    .editor-box {
        min-height: 350px;
    }
}

@media (max-width: 768px) {
    .sql-converter-interface {
        margin-bottom: 2rem;
    }

    .converter-wrapper {
        border-radius: var(--sql-radius);
    }

    .options-panel {
        padding: 1.25rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .section-header {
        padding: 1rem 1.25rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .header-content {
        flex-wrap: wrap;
    }

    .section-title {
        font-size: 1rem;
    }

    .section-badge {
        font-size: 0.6875rem;
        padding: 0.1875rem 0.625rem;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
    }

    .icon-btn svg {
        width: 16px;
        height: 16px;
    }

    .editor-box {
        min-height: 300px;
    }

    .code-editor {
        min-height: 300px;
        font-size: 13px;
    }

    .section-footer {
        padding: 0.75rem 1.25rem;
    }

    .footer-text {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .options-panel {
        padding: 1rem;
    }

    .section-header {
        padding: 0.875rem 1rem;
    }

    .editor-box {
        min-height: 250px;
    }

    .code-editor {
        min-height: 250px;
        font-size: 12px;
    }
}

/* Loading and Error States */
.section-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--sql-error);
}

.section-badge.processing {
    background: rgba(245, 158, 11, 0.1);
    color: var(--sql-warning);
}

/* Smooth Transitions */
* {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Focus Visible for Accessibility */
.icon-btn:focus-visible,
.option-input:focus-visible,
.option-select:focus-visible {
    outline: 2px solid var(--sql-primary);
    outline-offset: 2px;
}
