/* XML Converter – mobile-first, tool-specific (xc-*) */

/* --- Tool wrapper --- */
.xc-tool {
    --xc-radius: 12px;
    --xc-radius-sm: 8px;
    --xc-input-bg: var(--surface-muted, #f8f9fa);
    --xc-border: var(--border, #e9ecef);
    --xc-focus: var(--primary, #276ad0);
    --xc-error: #dc3545;
    --xc-success: #28a745;
    background: var(--surface, #fff);
    border: 1px solid var(--xc-border);
    border-radius: var(--xc-radius);
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-soft, 0 2px 8px rgba(0, 0, 0, 0.06));
}

/* Format strip – horizontal scroll on small screens */
.xc-formats {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--xc-input-bg);
    border-bottom: 1px solid var(--xc-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.xc-format {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: 2px solid var(--xc-border);
    border-radius: var(--xc-radius-sm);
    background: var(--surface, #fff);
    color: var(--text-main, #212529);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    white-space: nowrap;
}

.xc-format:hover {
    border-color: var(--xc-focus);
    background: var(--surface, #fff);
}

.xc-format.active {
    border-color: var(--xc-focus);
    background: var(--xc-focus);
    color: #fff;
}

.xc-format i {
    font-size: 1rem;
}

/* Panes – stacked on all viewports */
.xc-panes {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.xc-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.xc-pane-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main, #212529);
    background: var(--xc-input-bg);
    border-bottom: 1px solid var(--xc-border);
}

.xc-pane-label i {
    color: var(--xc-focus);
}

.xc-input,
.xc-output {
    width: 100%;
    min-height: 220px;
    padding: 1rem;
    border: none;
    border-bottom: 1px solid var(--xc-border);
    font-family: ui-monospace, "Cascadia Code", "Fira Code", Monaco, Consolas, monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    background: var(--surface, #fff);
    color: var(--text-main, #212529);
    transition: background 0.2s, box-shadow 0.2s;
}

.xc-input::placeholder,
.xc-output::placeholder {
    color: var(--text-muted, #6c757d);
}

.xc-input:focus,
.xc-output:focus {
    outline: none;
    background: var(--surface, #fff);
    box-shadow: inset 0 0 0 2px var(--xc-focus);
}

.xc-input.error {
    background: #fff5f5;
    box-shadow: inset 0 0 0 2px var(--xc-error);
}

.xc-output {
    cursor: default;
}

/* Action row */
.xc-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--xc-input-bg);
    border-bottom: 1px solid var(--xc-border);
}

.xc-convert {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--xc-radius-sm);
    background: var(--xc-focus);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}

.xc-convert:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(39, 106, 208, 0.35);
}

.xc-convert:active:not(:disabled) {
    transform: translateY(0);
}

.xc-convert:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.xc-sample {
    color: var(--xc-focus);
    font-size: 0.9rem;
    text-decoration: none;
    padding: 0.35rem 0;
}

.xc-sample:hover {
    text-decoration: underline;
}

.xc-spinner {
    display: none;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: xc-spin 0.7s linear infinite;
}

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

/* Error message */
.xc-err {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: var(--xc-radius-sm);
    margin: 0 1rem 0.5rem;
    display: none;
}

.xc-err.show {
    display: block;
}

/* Toolbar under output */
.xc-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--xc-input-bg);
    border-top: 1px solid var(--xc-border);
}

.xc-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--xc-border);
    border-radius: var(--xc-radius-sm);
    background: var(--surface, #fff);
    color: var(--text-main, #212529);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.xc-bar-btn:hover {
    border-color: var(--xc-focus);
    color: var(--xc-focus);
}

.xc-bar-btn.success {
    border-color: var(--xc-success);
    color: var(--xc-success);
}

/* Content blocks – unique section styling */
.xc-content {
    margin-bottom: 2rem;
}

.xc-content h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.xc-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.xc-content p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.xc-content ul {
    margin-bottom: 1rem;
    padding-left: 1.25rem;
}

.xc-content li {
    margin-bottom: 0.35rem;
}

/* Tablet and up: taller panes */
@media (min-width: 768px) {
    .xc-formats {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .xc-input,
    .xc-output {
        min-height: 320px;
    }
}

@media (min-width: 992px) {
    .xc-input,
    .xc-output {
        min-height: 380px;
    }
}
