:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #475569;
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --radius: 12px;
    --radius-sm: 8px;
}

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

html, body {
    height: 100%;
    width: 100%;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
}

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

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}

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

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

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 1.5rem;
    padding: 1.5rem;
}

/* Panels */
.panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.input-panel {
    flex: 1;
    max-width: 45%;
}

.settings-panel {
    flex: 1;
    max-width: 55%;
}

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

.panel-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* URL Textarea */
.url-textarea {
    flex: 1;
    width: 100%;
    padding: 1rem;
    background: var(--bg-dark);
    border: none;
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

.url-textarea:focus {
    background: #0a0f1d;
}

.url-textarea::placeholder {
    color: var(--secondary);
}

.input-stats {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-dark);
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.valid-badge {
    color: var(--success);
    font-weight: 600;
}

.invalid-badge {
    color: var(--error);
    font-weight: 600;
}

/* Settings Section */
.settings-section {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

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

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.setting-item input,
.setting-item select {
    padding: 0.625rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
}

.setting-item input:focus,
.setting-item select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.setting-item input[type="range"] {
    padding: 0;
    cursor: pointer;
}

.range-value {
    font-size: 0.875rem;
    color: var(--primary);
    font-weight: 600;
    text-align: right;
}

/* Preview Section */
.preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
}

.preview-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
}

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

.preview-container {
    flex: 1;
    overflow: auto;
    background: var(--bg-dark);
    position: relative;
}

.preview-container pre {
    margin: 0;
    padding: 1.25rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.preview-container code {
    display: block;
}

.preview-container code.placeholder {
    color: var(--secondary);
    font-style: italic;
}

/* XML Syntax Highlighting */
.xml-tag { color: #ff79c6; }
.xml-attr { color: #50fa7b; }
.xml-value { color: #f1fa8c; }
.xml-content { color: #f8f8f2; }
.xml-comment { color: #6272a4; }

.preview-stats {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* URL Editor Modal */
.url-editor {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.url-editor.active {
    display: flex;
}

.editor-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.editor-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

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

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

.editor-body {
    flex: 1;
    overflow: auto;
    padding: 1.25rem;
}

.url-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 0.75rem;
    padding: 0.875rem;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
}

.url-item:hover {
    border-color: var(--primary);
}

.url-item input,
.url-item select {
    padding: 0.5rem 0.625rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.8125rem;
    outline: none;
}

.url-item input:focus,
.url-item select:focus {
    border-color: var(--primary);
}

.url-item input[readonly] {
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: default;
}

.editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-dark);
}

/* Notification */
.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

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

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

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

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .input-panel,
    .settings-panel {
        max-width: 100%;
        flex: none;
    }
    
    .input-panel {
        height: 40%;
    }
    
    .settings-panel {
        height: 60%;
    }
    
    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .url-item {
        grid-template-columns: 1fr;
    }
    
    .editor-content {
        max-height: 90vh;
        margin: 1rem;
    }
}

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

.url-item {
    animation: fadeIn 0.3s ease;
}