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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #edf5ff;
    --bg-hover: #e2e8f0;
    --text-primary: #d4d4d4;
    --text-secondary: #9cdcfe;
    --accent-primary: #0f4ba5;
    --accent-hover: #0098ff;
    --accent-success: #4ec9b0;
    --accent-error: #f48771;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.subtitle {
    color: #64748b;
    font-size: 1rem;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.mode-selector,
.action-selector {
    display: flex;
    gap: 8px;
}

.mode-btn,
.action-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mode-btn:hover,
.action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

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

.editor-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
    flex: 1;
    min-height: 400px;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.editor-panel {
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.byte-counter {
    font-size: 12px;
    color: #64748b;
    font-family: 'Consolas', monospace;
}

.editor-panel textarea {
    flex: 1;
    width: 100%;
    padding: 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
    resize: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
}

.editor-panel textarea::placeholder {
    color: #5a5a5a;
}

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

.divider {
    width: 1px;
    background: var(--border-color);
}

.savings-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: var(--accent-success);
    color: var(--bg-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.editor-panel {
    position: relative;
}

.button-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn svg {
    flex-shrink: 0;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

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

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

.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: rgba(244, 135, 113, 0.1);
    border: 1px solid var(--accent-error);
    border-radius: 8px;
    color: var(--accent-error);
}

.error-message svg {
    flex-shrink: 0;
}

.footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    color: #64748b;
    font-size: 13px;
}

@media (max-width: 900px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .mode-selector,
    .action-selector {
        justify-content: center;
    }
    
    .editor-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto 1fr;
    }
    
    .divider {
        width: 100%;
        height: 1px;
    }
    
    .button-bar {
        justify-content: center;
    }
    
    .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
}

@media (max-width: 500px) {
    .container {
        padding: 10px;
    }
    
    .mode-btn,
    .action-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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