/* CSS Variables & Theme System */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #818cf8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --secondary-color: #64748b;

    --bg-color: #fafbfc;
    --surface-color: #ffffff;
    --card-color: #ffffff;
    --border-color: #e2e8f0;
    --divider-color: #cbd5e1;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 2px 4px 0 rgb(0 0 0 / 0.06), 0 1px 2px 0 rgb(0 0 0 / 0.03);
    --shadow-md: 0 4px 8px -2px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.04);
    --shadow-lg: 0 12px 24px -4px rgb(0 0 0 / 0.12), 0 4px 8px -4px rgb(0 0 0 / 0.06);
    --shadow-xl: 0 24px 48px -12px rgb(0 0 0 / 0.18), 0 8px 16px -8px rgb(0 0 0 / 0.08);

    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1.25rem;

    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #6366f1;
        --primary-hover: #818cf8;
        --primary-light: #a5b4fc;
        --success-color: #34d399;
        --warning-color: #fbbf24;
        --error-color: #f87171;

        --bg-color: #0a0f1e;
        --surface-color: #1e293b;
        --card-color: #1e293b;
        --border-color: #334155;
        --divider-color: #475569;

        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        --text-inverse: #0f172a;

        --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
        --shadow: 0 2px 4px 0 rgb(0 0 0 / 0.5), 0 1px 2px 0 rgb(0 0 0 / 0.4);
        --shadow-md: 0 4px 8px -2px rgb(0 0 0 / 0.6), 0 2px 4px -2px rgb(0 0 0 / 0.5);
        --shadow-lg: 0 12px 24px -4px rgb(0 0 0 / 0.7), 0 4px 8px -4px rgb(0 0 0 / 0.6);
        --shadow-xl: 0 24px 48px -12px rgb(0 0 0 / 0.8), 0 8px 16px -8px rgb(0 0 0 / 0.7);
    }
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px) saturate(180%);
    background-color: rgba(255, 255, 255, 0.95);
}

@media (prefers-color-scheme: dark) {
    .header {
        background-color: rgba(30, 41, 59, 0.95);
    }
}

.tool-header {
    text-align: center;
}

.tool-title-section h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.375rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.tool-title-section p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 680px;
    margin: 0 auto;
    line-height: 1.5;
}

.main {
    padding: 2rem 0 4rem;
    min-height: calc(100vh - 120px);
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.375rem;
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
    scrollbar-width: thin;
}

.tab-nav::-webkit-scrollbar {
    height: 4px;
}

.tab-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}

.tab-btn {
    padding: 0.625rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    position: relative;
    letter-spacing: -0.01em;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-color);
    transform: translateY(-1px);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
    transform: translateY(0);
}

.tab-btn.active:hover {
    transform: translateY(-1px);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* JSON Editor Tab */
.json-workspace {
    background: var(--card-color);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
}

.json-workspace:hover {
    box-shadow: var(--shadow-lg);
}

.file-operations {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1.25rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
    flex-wrap: wrap;
}

.file-controls {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.file-info {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 550px;
}

.editor-section {
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-color);
}

.editor-section:first-child {
    border-right: 1px solid var(--border-color);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(to bottom, var(--surface-color), var(--bg-color));
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
}

.section-label {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.875rem;
    letter-spacing: -0.01em;
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.editor-container {
    flex: 1;
    position: relative;
    background: var(--bg-color);
    overflow: hidden;
}

.code-editor {
    width: 100%;
    height: 100%;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.65;
    resize: none;
    border: none;
    outline: none;
    padding: 1.125rem;
    background: var(--bg-color);
    color: var(--text-primary);
    white-space: pre;
    overflow: auto;
    scrollbar-width: thin;
}

.code-editor::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-editor::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.code-editor::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}

.code-editor::-webkit-scrollbar-thumb:hover {
    background: var(--divider-color);
}

.code-textarea {
    width: 100%;
    height: 100%;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.65;
    resize: none;
    border: none;
    outline: none;
    padding: 1.125rem;
    background: var(--bg-color);
    color: var(--text-primary);
    scrollbar-width: thin;
}

.code-textarea::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-textarea::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.code-textarea::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}

.code-textarea::-webkit-scrollbar-thumb:hover {
    background: var(--divider-color);
}

.readonly {
    background: var(--surface-color);
    color: var(--text-secondary);
    cursor: default;
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(to top, var(--surface-color), var(--bg-color));
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.validation-status, .operation-status {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.validation-status.success, .operation-status.success {
    color: var(--success-color);
}

.validation-status.error, .operation-status.error {
    color: var(--error-color);
}

.editor-stats {
    color: var(--text-muted);
    font-weight: 500;
}

/* Quick Actions */
.quick-actions {
    padding: 1.25rem;
    background: linear-gradient(to bottom, var(--bg-color), var(--surface-color));
    border-top: 1px solid var(--border-color);
}

.action-group {
    margin-bottom: 1.25rem;
}

.action-group:last-child {
    margin-bottom: 0;
}

.action-group h4 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.action-btn {
    padding: 0.5rem 1rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    letter-spacing: -0.01em;
}

.action-btn:hover {
    background: var(--surface-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

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

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn:hover::before {
    opacity: 1;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled::before {
    display: none;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--text-inverse);
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-inverse);
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
    background: #546575;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #14b989 100%);
    color: var(--text-inverse);
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover:not(:disabled) {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-success:active:not(:disabled) {
    transform: translateY(0);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #f59e0b 100%);
    color: var(--text-inverse);
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.btn-warning:hover:not(:disabled) {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-warning:active:not(:disabled) {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-outline:hover:not(:disabled) {
    background: var(--surface-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-outline:active:not(:disabled) {
    transform: translateY(0);
}

/* Tree View Tab */
.tree-workspace {
    background: var(--card-color);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    min-height: 600px;
}

.tree-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.tree-search {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 250px;
}

.tree-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.tree-container {
    padding: 1rem;
    background: var(--bg-color);
    min-height: 500px;
    overflow: auto;
}

.json-tree-view {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
}

.tree-node {
    margin: 0.25rem 0;
    padding-left: 1rem;
    position: relative;
}

.tree-node::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
}

.tree-key {
    color: var(--primary-color);
    font-weight: 500;
}

.tree-value {
    color: var(--text-primary);
}

.tree-string {
    color: var(--success-color);
}

.tree-number {
    color: #f97316;
}

.tree-boolean {
    color: #8b5cf6;
}

.tree-null {
    color: var(--text-muted);
    font-style: italic;
}

/* Convert Tab */
.convert-workspace {
    background: var(--card-color);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 1.75rem;
    transition: var(--transition);
}

.convert-workspace:hover {
    box-shadow: var(--shadow-lg);
}

.convert-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.convert-header h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.convert-header p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.conversion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.conversion-card {
    padding: 1.375rem;
    background: linear-gradient(135deg, var(--surface-color) 0%, var(--bg-color) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.conversion-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.conversion-card h4 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.conversion-card p {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.convert-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.convert-result {
    background: linear-gradient(to bottom, var(--surface-color), var(--bg-color));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.375rem;
    box-shadow: var(--shadow-sm);
}

.convert-result h4 {
    font-size: 1.0625rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.result-container {
    margin-bottom: 1rem;
}

.convert-textarea {
    width: 100%;
    height: 200px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    resize: vertical;
    transition: var(--transition-fast);
    scrollbar-width: thin;
}

.convert-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.convert-textarea::-webkit-scrollbar {
    width: 8px;
}

.convert-textarea::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.convert-textarea::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}

.convert-textarea::-webkit-scrollbar-thumb:hover {
    background: var(--divider-color);
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

/* Advanced Tools Tab */
.tools-workspace {
    background: var(--card-color);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.tool-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
}

.tool-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.tool-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tool-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.tool-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.tool-input, .tool-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.tool-textarea {
    width: 100%;
    height: 100px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    resize: vertical;
}

.tool-result {
    margin-top: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-item {
    padding: 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Compare Tab */
.compare-workspace {
    background: var(--card-color);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.compare-header {
    text-align: center;
    margin-bottom: 2rem;
}

.compare-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.compare-header p {
    color: var(--text-secondary);
}

.compare-layout {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: start;
}

.compare-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.compare-textarea {
    width: 100%;
    height: 300px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    resize: vertical;
}

.compare-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    padding-top: 2rem;
}

.compare-result {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.compare-result h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.diff-container {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    max-height: 400px;
    overflow: auto;
}

.diff-viewer {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.diff-added {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.diff-removed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.diff-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Side Panels */
.history-panel, .settings-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--card-color);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    z-index: 200;
    transition: var(--transition-slow);
    overflow-y: auto;
}

.history-panel.active, .settings-panel.active {
    right: 0;
}

.history-header, .settings-header {
    padding: 1.5rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h3, .settings-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.history-list {
    padding: 1rem;
}

.history-item {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.settings-content {
    padding: 1.5rem;
}

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-item label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.setting-item select, .setting-item input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
    color: var(--text-primary);
}

/* Action Bar */
.action-bar {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 150;
}

.action-btn {
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--border-color);
    background: var(--card-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
    font-size: 1.2rem;
}

.action-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-inverse);
    transform: scale(1.1);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 120px);
}

.help-section {
    margin-bottom: 2rem;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.shortcut-list {
    display: grid;
    gap: 0.75rem;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--surface-color);
    border-radius: var(--radius);
}

.shortcut-item kbd {
    padding: 0.25rem 0.5rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.help-list {
    list-style: none;
    padding: 0;
}

.help-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.help-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    background: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    transform: translateX(100%);
    transition: var(--transition);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.toast.error {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

.toast.warning {
    border-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .editor-layout {
        grid-template-columns: 1fr;
        gap: 1px;
    }

    .editor-section:first-child {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

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

    .compare-controls {
        flex-direction: row;
        justify-content: center;
        padding-top: 0;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .conversion-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 0.875rem;
    }

    .tool-title-section h1 {
        font-size: 1.625rem;
    }

    .tool-title-section p {
        font-size: 0.875rem;
    }

    .tab-nav {
        gap: 0.375rem;
        padding: 0.375rem;
        justify-content: flex-start;
    }

    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }

    .file-operations {
        flex-direction: column;
        gap: 0.875rem;
        align-items: stretch;
    }

    .file-controls {
        justify-content: center;
    }

    .editor-header {
        flex-direction: column;
        gap: 0.875rem;
        align-items: stretch;
    }

    .editor-actions {
        align-self: stretch;
        justify-content: space-between;
    }

    .editor-layout {
        min-height: 480px;
    }

    .action-bar {
        bottom: 1rem;
        right: 1rem;
        gap: 0.375rem;
    }

    .action-btn {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 1.125rem;
    }

    .history-panel, .settings-panel {
        width: 100%;
        right: -100%;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 85vh;
    }

    .toast-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
    }

    .toast {
        max-width: none;
    }

    .conversion-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        padding: 1rem;
    }

    .action-group h4 {
        font-size: 0.6875rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .tool-title-section h1 {
        font-size: 1.375rem;
    }

    .tool-title-section p {
        font-size: 0.8125rem;
    }

    .tab-btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.75rem;
    }

    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.75rem;
    }

    .editor-layout {
        min-height: 400px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-bar {
        bottom: 0.75rem;
        right: 0.75rem;
    }

    .action-btn {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }
}

/* Modern Visual Enhancements & Animations */

/* Smooth focus states for inputs */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    transition: var(--transition-fast);
}

/* Loading skeleton animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.loading-skeleton {
    background: linear-gradient(
        90deg,
        var(--surface-color) 25%,
        var(--border-color) 50%,
        var(--surface-color) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Pulse animation for active indicators */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Slide in animation for panels */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Bounce animation for buttons */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* Enhanced drag and drop zone */
.editor-container.drag-over {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border: 2px dashed var(--primary-color);
    animation: pulse 1.5s ease-in-out infinite;
}

/* Glassmorphism effect for floating elements */
.glass-effect {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@media (prefers-color-scheme: dark) {
    .glass-effect {
        background: rgba(30, 41, 59, 0.7);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Enhanced scrollbar for better UX */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--divider-color);
}

::-webkit-scrollbar-corner {
    background: var(--bg-color);
}

/* Selection styling */
::selection {
    background-color: rgba(79, 70, 229, 0.2);
    color: var(--text-primary);
}

::-moz-selection {
    background-color: rgba(79, 70, 229, 0.2);
    color: var(--text-primary);
}

/* Improved focus visible for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Hover effect for interactive cards */
.interactive-card {
    transition: var(--transition);
}

.interactive-card:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: var(--shadow-lg);
}

/* Gradient text effect */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Floating animation for action buttons */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.action-bar .action-btn:nth-child(1) {
    animation: float 3s ease-in-out infinite;
}

.action-bar .action-btn:nth-child(2) {
    animation: float 3s ease-in-out 0.5s infinite;
}

.action-bar .action-btn:nth-child(3) {
    animation: float 3s ease-in-out 1s infinite;
}

.action-bar .action-btn:nth-child(4) {
    animation: float 3s ease-in-out 1.5s infinite;
}

/* Smooth transitions for theme switching */
body,
.header,
.tab-nav,
.btn,
.card,
.modal-content,
.panel {
    transition: background-color 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

/* Ripple effect */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    width: 100px;
    height: 100px;
    margin-top: -50px;
    margin-left: -50px;
    top: 50%;
    left: 50%;
    animation: ripple 1s;
    opacity: 0;
}

.ripple-effect:active::after {
    animation: ripple 0.6s;
}

/* Skeleton loader for content loading states */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface-color) 0%,
        var(--border-color) 50%,
        var(--surface-color) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}

/* Enhanced toast notifications with slide-in */
@keyframes slideInFromRight {
    from {
        transform: translateX(calc(100% + 2rem));
    }
    to {
        transform: translateX(0);
    }
}

.toast.show {
    animation: slideInFromRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Status indicators with glow effect */
.status-indicator {
    position: relative;
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-indicator.success {
    background: var(--success-color);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.status-indicator.error {
    background: var(--error-color);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.status-indicator.warning {
    background: var(--warning-color);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}