:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --text-bright: #f0f6fc;
    
    --border-color: #30363d;
    --border-light: #21262d;
    
    --accent-primary: #58a6ff;
    --accent-secondary: #1f6feb;
    --accent-hover: #388bfd;
    
    --success: #238636;
    --success-hover: #2ea043;
    --warning: #f85149;
    --warning-hover: #da3633;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
    
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #eaeef2;
    --bg-hover: #dee3e9;
    
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --text-muted: #8c959f;
    --text-bright: #1f2328;
    
    --border-color: #d0d7de;
    --border-light: #eaeef2;
    
    --accent-primary: #0969da;
    --accent-secondary: #0550ae;
    --accent-hover: #0860ca;
    
    --success: #1a7f37;
    --success-hover: #2a9843;
    --warning: #cf222e;
    --warning-hover: #a40e26;
}

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

html, body {
    height: 100%;
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Header Styles */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 60px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-bright);
    letter-spacing: -0.3px;
}

.pro-badge {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.stats-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    background-color: var(--bg-tertiary);
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-light);
}

.stats-bar .divider {
    color: var(--border-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* Toolbar Styles */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    gap: 20px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Button Styles */
.btn-primary, .btn-secondary, .btn-accent, .btn-small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-primary:hover {
    background-color: var(--success-hover);
    border-color: var(--success-hover);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-accent {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.btn-accent:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: var(--shadow-sm);
}

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
    background-color: transparent;
    color: var(--text-secondary);
}

.btn-small:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

/* Form Controls */
.select-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.select-wrapper label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

select {
    padding: 6px 10px;
    font-size: 12px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    outline: none;
    font-family: var(--font-sans);
}

select:hover, select:focus {
    border-color: var(--accent-primary);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.checkbox-wrapper:hover {
    color: var(--text-primary);
}

/* Editor Container */
.editor-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    background-color: var(--bg-primary);
}

.editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.input-pane {
    border-right: 1px solid var(--border-color);
}

.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.pane-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.drop-text {
    font-size: 11px;
    color: var(--text-muted);
    pointer-events: none;
}

.output-actions {
    display: flex;
    gap: 8px;
}

.editor-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.editor-wrapper textarea {
    width: 100%;
    height: 100%;
    padding: 16px;
    border: none;
    outline: none;
    resize: none;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    tab-size: 4;
    -moz-tab-size: 4;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

.editor-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.editor-wrapper textarea:focus {
    background-color: var(--bg-primary);
}

#output-editor {
    background-color: var(--bg-secondary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border: 3px solid var(--bg-primary);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

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

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 20px;
    background-color: var(--accent-primary);
    color: white;
    font-size: 12px;
    flex-shrink: 0;
}

.status-left {
    font-weight: 500;
}

.status-right {
    display: flex;
    gap: 20px;
}

.shortcut-hint {
    opacity: 0.9;
    font-family: var(--font-mono);
    font-size: 11px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background-color: var(--success);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    transition: all 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

.toast.error {
    background-color: var(--warning);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.modal.hidden .modal-content {
    transform: scale(0.9);
}

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

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-bright);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

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

.modal-body {
    padding: 20px;
}

.shortcut-grid {
    display: grid;
    gap: 12px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

kbd {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-bottom-color: var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 -1px 0 var(--border-color);
    color: var(--text-primary);
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1;
    padding: 4px 8px;
    white-space: nowrap;
}

.shortcut-item span {
    color: var(--text-secondary);
    flex: 1;
}

/* Drag and Drop Overlay */
.drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(88, 166, 255, 0.1);
    border: 2px dashed var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.drag-overlay.active {
    opacity: 1;
}

.drag-overlay-text {
    font-size: 18px;
    color: var(--accent-primary);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .toolbar-group {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .editor-container {
        flex-direction: column;
    }
    
    .input-pane {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .stats-bar {
        font-size: 11px;
        padding: 4px 12px;
    }
}

@media (max-width: 640px) {
    .app-header {
        padding: 0 12px;
        height: 50px;
    }
    
    .logo h1 {
        font-size: 14px;
    }
    
    .pro-badge {
        display: none;
    }
    
    .stats-bar {
        display: none;
    }
    
    .toolbar {
        padding: 8px 12px;
    }
    
    .status-right {
        display: none;
    }
    
    .editor-wrapper textarea {
        font-size: 12px;
        padding: 12px;
    }
}

/* Loading Animation */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Focus Visible */
button:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Selection Color */
::selection {
    background-color: rgba(88, 166, 255, 0.3);
    color: var(--text-bright);
}

/* Print Styles */
@media print {
    .app-header,
    .toolbar,
    .status-bar,
    .toast,
    .modal {
        display: none !important;
    }
    
    .editor-container {
        height: auto;
    }
    
    .input-pane {
        display: none;
    }
    
    .output-pane {
        width: 100%;
        border: none;
    }
    
    textarea {
        resize: none;
        border: none !important;
        overflow: visible !important;
    }
}