:root {
    /* Crimson Red Palette */
    --primary: #D63031;
    /* Crimson Red */
    --primary-hover: #b22828;
    --secondary: #FF7675;
    /* Soft Pink/Red */
    --accent: #00CEC9;
    /* Neon Cyan */

    --bg-dark: #1A0A0A;
    /* Deep Red-tinted Dark */
    --bg-panel: rgba(38, 10, 10, 0.7);
    --bg-input: rgba(0, 0, 0, 0.5);

    --border-light: rgba(214, 48, 49, 0.15);
    --border-focus: rgba(214, 48, 49, 0.6);

    --text-primary: #F8FAFC;
    --text-muted: #A38383;

    --radius: 12px;
    --transition: 0.25s ease;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(214, 48, 49, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 206, 201, 0.03) 0%, transparent 40%);
}

.code-font {
    font-family: 'JetBrains Mono', monospace;
}

.text-secondary {
    color: var(--secondary);
    opacity: 0.9;
}

.text-accent {
    color: var(--accent);
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.85rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-row {
    display: flex;
    align-items: center;
}

.flex-1 {
    flex: 1;
    min-height: 0;
}

.gap-m {
    gap: 1rem;
}

.gap-l {
    gap: 1.5rem;
}

.gap-xl {
    gap: 2rem;
}

.mt-m {
    margin-top: 1rem;
}

.mt-l {
    margin-top: 1.5rem;
}

.mb-s {
    margin-bottom: 0.5rem;
}

.mb-m {
    margin-bottom: 1rem;
}

.pb-s {
    padding-bottom: 0.5rem;
}

.border-b {
    border-bottom: 1px solid var(--border-light);
}

.full-width {
    width: 100%;
}

.relative {
    position: relative;
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* App Layout */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    flex-shrink: 0;
}

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

.brand-icon {
    color: var(--primary);
}

.app-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge.outline {
    background: transparent;
    border: 1px dashed var(--border-light);
    color: var(--text-muted);
}

/* Workspace */
.workspace {
    flex: 1;
    display: flex;
    gap: 1.5rem;
    min-height: 0;
}

.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary);
}

.panel-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

/* Form Inputs */
.form-input {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    resize: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(214, 48, 49, 0.2);
}

.error-msg {
    color: #ff7675;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(214, 48, 49, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(214, 48, 49, 0.3);
    font-size: 0.9rem;
    word-break: break-all;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: var(--transition);
}

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

.primary-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 15px rgba(214, 48, 49, 0.3);
}

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

.outline-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sn-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
}

/* Tabs */
.tab-header {
    padding: 0.5rem 1.5rem;
}

.tabs {
    display: flex;
    gap: 0.5rem;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

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

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    height: 100%;
    flex-direction: column;
}

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

/* Empty State */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

/* Stats Group */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-lbl {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.stat-val {
    font-size: 1rem;
    font-weight: 500;
    word-break: break-all;
}

/* Info list */
.panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.kv-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kv-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.kv-row .k {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.kv-row .v {
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    background: rgba(0, 0, 0, 0.2);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.data-table td {
    word-break: break-all;
}

/* XML */
#xml-output {
    margin: 0;
    padding: 1rem;
    background: var(--bg-input);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    flex: 1;
    overflow: auto;
    color: var(--secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Scrollbars */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(214, 48, 49, 0.2);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(214, 48, 49, 0.4);
}

@media (max-width: 900px) {
    .workspace {
        flex-direction: column;
    }

    .panel {
        height: 50vh;
    }

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

    .flex-row {
        flex-direction: column;
    }
}