/* 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 TSV Converter Styles */
:root {
    --tsv-primary: #6366f1;
    --tsv-primary-dark: #4f46e5;
    --tsv-primary-light: #eef2ff;
    --tsv-accent: #8b5cf6;
    --tsv-surface: #ffffff;
    --tsv-surface-alt: #f8fafc;
    --tsv-border: #e2e8f0;
    --tsv-border-focus: #6366f1;
    --tsv-text: #0f172a;
    --tsv-text-muted: #64748b;
    --tsv-success: #10b981;
    --tsv-error: #ef4444;
    --tsv-warning: #f59e0b;
    --tsv-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --tsv-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --tsv-shadow-md: 0 10px 15px rgba(0, 0, 0, 0.1);
    --tsv-shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.1);
    --tsv-radius: 12px;
    --tsv-radius-lg: 16px;
    --tsv-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tsv-converter-wrapper {
    margin: 2rem 0 4rem;
}

.converter-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--tsv-surface);
    border-radius: var(--tsv-radius-lg);
    box-shadow: var(--tsv-shadow-md);
    padding: 1.5rem;
    border: 1px solid var(--tsv-border);
}

@media (min-width: 768px) {
    .converter-card {
        padding: 2rem;
        gap: 2rem;
    }
}

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

.options-content {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .options-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

.option-item {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    user-select: none;
    transition: var(--tsv-transition);
}

.option-item:hover {
    opacity: 0.8;
}

.option-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    margin-right: 0.75rem;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--tsv-primary);
    flex-shrink: 0;
}

.option-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.option-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--tsv-text);
    line-height: 1.4;
}

.option-desc {
    font-size: 0.8125rem;
    color: var(--tsv-text-muted);
    line-height: 1.4;
}

/* Editors Container */
.editors-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 992px) {
    .editors-container {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

/* Editor Panels */
.editor-panel,
.output-panel {
    display: flex;
    flex-direction: column;
    min-height: 400px;
    background: var(--tsv-surface);
    border-radius: var(--tsv-radius);
    border: 1px solid var(--tsv-border);
    overflow: hidden;
}

@media (min-width: 992px) {
    .editor-panel,
    .output-panel {
        min-height: 500px;
    }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--tsv-surface-alt);
    border-bottom: 1px solid var(--tsv-border);
    gap: 1rem;
}

.panel-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.panel-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--tsv-text);
    margin: 0;
    white-space: nowrap;
}

.panel-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--tsv-border);
    color: var(--tsv-text-muted);
    white-space: nowrap;
    transition: var(--tsv-transition);
}

.panel-badge.success {
    background: var(--tsv-primary-light);
    color: var(--tsv-primary);
}

.panel-badge.error {
    background: #fee2e2;
    color: var(--tsv-error);
}

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

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

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

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

.btn-icon svg {
    flex-shrink: 0;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--tsv-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--tsv-transition);
    white-space: nowrap;
}

.btn-primary:hover {
    background: var(--tsv-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--tsv-shadow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary svg {
    flex-shrink: 0;
}

/* Editor Wrapper */
.editor-wrapper {
    flex: 1;
    position: relative;
    min-height: 350px;
    overflow: hidden;
}

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

.output-editor {
    background: var(--tsv-surface-alt);
}

/* ACE Editor Customization */
.ace_editor {
    border-radius: 0;
}

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

.ace_gutter-active-line {
    background: var(--tsv-primary-light);
}

.ace_content {
    background: var(--tsv-surface);
}

.output-editor .ace_content {
    background: var(--tsv-surface-alt);
}

.ace-cursor {
    color: var(--tsv-primary);
}

.ace_selection {
    background: var(--tsv-primary-light);
}

/* Mobile Optimizations */
@media (max-width: 767px) {
    .converter-card {
        padding: 1rem;
        gap: 1.25rem;
    }

    .panel-header {
        flex-wrap: wrap;
        padding: 0.875rem 1rem;
    }

    .panel-title-group {
        width: 100%;
        order: 1;
    }

    .panel-actions {
        width: 100%;
        order: 2;
        justify-content: flex-end;
    }

    .options-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .editors-container {
        gap: 1.25rem;
    }

    .editor-panel,
    .output-panel {
        min-height: 300px;
    }

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

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

    .btn-primary {
        flex: 1;
        justify-content: center;
    }
}

/* Loading and Error States */
.panel-badge.loading {
    position: relative;
    overflow: hidden;
}

.panel-badge.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Focus States */
.btn-icon:focus-visible,
.btn-primary:focus-visible {
    outline: 2px solid var(--tsv-primary);
    outline-offset: 2px;
}

.option-item input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--tsv-primary);
    outline-offset: 2px;
}

/* Dark Mode Support (if needed) */
@media (prefers-color-scheme: dark) {
    :root {
        --tsv-surface: #1e293b;
        --tsv-surface-alt: #0f172a;
        --tsv-border: #334155;
        --tsv-text: #f1f5f9;
        --tsv-text-muted: #94a3b8;
    }
}
