/* ==========================================================================
   FAR Manager - XML Viewer Styles
   ========================================================================== */

/* XML Viewer Overlay */
.xml-viewer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: calc(var(--z-modal) + 500);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 20px;
}

.xml-viewer-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* XML Viewer Panel */
.xml-viewer {
    width: 100%;
    max-width: 1000px;
    height: 85vh;
    max-height: 800px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    transition: var(--transition);
}

.xml-viewer-overlay.active .xml-viewer {
    transform: scale(1) translateY(0);
}

/* XML Viewer Header */
.xml-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 12px;
}

.xml-viewer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    min-width: 0;
    flex: 1;
}

.xml-viewer-title svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
    flex-shrink: 0;
}

.xml-viewer-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* XML Viewer Actions */
.xml-viewer-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.xml-viewer-btn {
    padding: 6px 12px;
    background: var(--bg-hover);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.xml-viewer-btn:hover {
    background: var(--bg-active);
}

.xml-viewer-btn svg {
    width: 14px;
    height: 14px;
}

.xml-viewer-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

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

/* XML Viewer Content */
.xml-viewer-content {
    flex: 1;
    overflow: auto;
    background: #1a1a1c;
    -webkit-overflow-scrolling: touch;
    padding: 0;
}

.xml-code {
    padding: 20px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-primary);
    margin: 0;
    tab-size: 2;
}

/* XML Editor */
.xml-editor {
    width: 100%;
    height: 100%;
    min-height: 400px;
    margin: 0;
    padding: 20px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    tab-size: 2;
    -moz-tab-size: 2;
    box-sizing: border-box;
}

.xml-editor:focus {
    outline: none;
}

/* Modified indicator */
.xml-viewer-modified {
    color: var(--warning);
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Primary button style */
.xml-viewer-btn.primary {
    background: var(--accent);
    color: white;
}

.xml-viewer-btn.primary:hover {
    background: var(--accent-hover);
}

/* XML Syntax Highlighting */
.xml-tag { color: #ff7b72; }
.xml-attr-name { color: #79c0ff; }
.xml-attr-value { color: #a5d6ff; }
.xml-text { color: #c9d1d9; }
.xml-comment { color: #8b949e; font-style: italic; }
.xml-cdata { color: #7ee787; }
.xml-declaration { color: #d2a8ff; }
.xml-bracket { color: #8b949e; }
.xml-equals { color: #8b949e; }

/* Mobile adjustments */
@media (max-width: 768px) {
    .xml-viewer-overlay {
        padding: 0;
    }
    
    .xml-viewer {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
    
    .xml-viewer-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        position: relative; /* Necesario para posicionar la X */
        padding-right: 48px; /* Dejar espacio para que el texto no tape la X */
    }
    
    /* Forzar la X a la esquina superior derecha */
    .xml-viewer-close {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 34px;
        height: 34px;
        background: transparent;
        z-index: 10;
    }
    
    .xml-viewer-title {
        font-size: 13px;
        flex: 1 1 100%;
        margin-bottom: 8px;
        padding-right: 0;
    }
    
    /* Ajustar acciones para que no choquen */
    .xml-viewer-actions {
        flex: 1 1 100%;
        justify-content: flex-start; /* Alinear botones a la izquierda en móvil */
        gap: 12px;
        padding-bottom: 4px;
    }
    
    .xml-viewer-btn span {
        display: none;
    }
    
    .xml-viewer-btn {
        padding: 8px;
    }
    
    .xml-viewer-content {
        padding: 0;
    }
    
    .xml-code {
        padding: 16px;
        font-size: 12px;
        line-height: 1.5;
    }
    
    .xml-editor {
        padding: 16px;
        font-size: 12px;
        line-height: 1.5;
    }
    
    .xml-viewer-modified {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .xml-viewer-header {
        padding: 10px 12px;
    }
    
    .xml-viewer-actions {
        gap: 4px;
    }
    
    .xml-code {
        padding: 12px;
        font-size: 11px;
    }
    
    .xml-editor {
        padding: 12px;
        font-size: 11px;
    }
}
