:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --background: #ffffff;
    --surface: #f8fafc;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 1rem;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--background);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.app-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.logo {
    width: 2.5rem;
    height: 2.5rem;
}

.subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
}

.language-selector {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--background);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}

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

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

.main-content {
    padding: 2rem;
}

.input-section,
.output-section {
    margin-bottom: 2rem;
}

.section-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.text-input,
.text-output {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: "SF Mono", Monaco, "Cascadia Mono", "Roboto Mono", Consolas, monospace;
    font-size: 0.9375rem;
    resize: vertical;
    transition: border-color 0.2s;
}

.text-input:focus,
.text-output:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-stats {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.operations-panel {
    margin: 2rem 0;
}

.operation-category {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.category-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.625rem 1.25rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

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

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

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

.regex-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.regex-input {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.regex-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.regex-options {
    display: flex;
    gap: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

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

.icon-btn {
    padding: 0.5rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn svg {
    width: 1.25rem;
    height: 1.25rem;
    stroke: var(--text-secondary);
}

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

.icon-btn:hover svg {
    stroke: white;
}

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

.icon-btn.success svg {
    stroke: white;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s;
}

.modal-content {
    background-color: var(--background);
    margin: 10% auto;
    padding: 2rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s;
}

.modal-close {
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

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

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.modal-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    transition: border-color 0.2s;
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.footer {
    text-align: center;
    padding: 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@media (max-width: 768px) {
    .app-title {
        font-size: 1.5rem;
    }
    
    .logo {
        width: 2rem;
        height: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .language-selector {
        flex-wrap: wrap;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
    
    .regex-options {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .main-content {
        padding: 1rem;
    }
}