/* Estilos específicos para el tutorial de DOM en PHP */
/* Tema púrpura/azul para manipulación de documentos */

.tutorial-article {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.article-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 3px solid #e2e8f0;
    position: relative;
}

.article-header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, #8b5cf6, #3b82f6);
    border-radius: 2px;
}

.article-title {
    font-size: 3rem;
    background: linear-gradient(90deg, #8b5cf6, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.article-subtitle {
    font-size: 1.4rem;
    color: #64748b;
    font-weight: 300;
    margin-bottom: 2rem;
}

.header-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    color: #475569;
    background: #f1f5f9;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.1);
}

.stat i {
    color: #8b5cf6;
    font-size: 1.2rem;
}

.content-section {
    margin-bottom: 4rem;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.content-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.content-section h2 {
    font-size: 2.2rem;
    color: #1e293b;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
}

.content-section h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100px;
    height: 2px;
    background: #8b5cf6;
}

/* Introducción - Árbol DOM */
.intro-section {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
}

.tree-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background: #1e293b;
    border-radius: 12px;
    color: #e2e8f0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    overflow-x: auto;
}

.tree-node {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #334155;
    border-radius: 6px;
    margin: 0.25rem 0;
    border-left: 3px solid #8b5cf6;
    flex-wrap: wrap;
}

.tree-node.root {
    background: #8b5cf6;
    color: white;
    border-left: 3px solid #fbbf24;
}

.tree-children {
    margin-left: 2rem;
    padding-left: 1rem;
    border-left: 2px dashed #475569;
}

.node-value {
    color: #fbbf24;
    background: #00000033;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

/* Comparación de código */
.code-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.code-block {
    background: #1e293b;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #334155;
}

.code-block h3 {
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem;
    margin: 0;
    font-size: 1rem;
    border-bottom: 2px solid #8b5cf6;
}

.code-block pre {
    margin: 0;
    padding: 1rem;
    color: #e2e8f0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    background: #1e293b;
}

.code-block code {
    color: #e2e8f0;
    background: transparent;
}

.demo-result-box {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.demo-output {
    padding: 1rem;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.output-line {
    padding: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.output-line:last-child {
    border-bottom: none;
}

.output-line strong {
    color: #8b5cf6;
}

/* Métodos Grid */
.methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.method-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 1.5rem;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.method-card:hover {
    border-color: #8b5cf6;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.1);
}

.method-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.method-card h3 {
    color: #1e293b;
    margin-bottom: 1rem;
}

.method-card ul {
    list-style: none;
    padding: 0;
}

.method-card li {
    padding: 0.5rem 0;
    color: #475569;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    border-bottom: 1px solid #e2e8f0;
}

.method-card li:last-child {
    border-bottom: none;
}

.method-card code {
    background: #e2e8f0;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: #334155;
}

/* Demostración interactiva */
.interactive-demo {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.demo-panel {
    flex: 1;
    min-width: 300px;
}

.demo-panel h3 {
    color: #475569;
    margin-bottom: 1rem;
}

/* Visores XML - FONDO OSCURO */
.xml-viewer {
    background: #1e293b;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    border: 1px solid #334155;
}

.xml-viewer pre {
    margin: 0;
    color: #e2e8f0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    background: transparent;
}

.xml-viewer code {
    color: #e2e8f0;
    background: transparent;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.demo-arrow {
    font-size: 3rem;
    color: #8b5cf6;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* Explicación de código - FONDO OSCURO */
.code-explanation {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.code-explanation h4 {
    color: #1e293b;
    margin-bottom: 1rem;
}

.code-explanation pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    border: 1px solid #334155;
    margin: 0;
}

.code-explanation code {
    color: #e2e8f0;
    background: transparent;
}

/* Estructura */
.structure-explanation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.node-types, .node-properties {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
}

.node-types h3, .node-properties h3 {
    color: #1e293b;
    margin-bottom: 1rem;
}

.node-types ul, .node-properties ul {
    list-style: none;
    padding: 0;
}

.node-types li, .node-properties li {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border-left: 3px solid #8b5cf6;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.node-type {
    font-weight: bold;
    color: #8b5cf6;
}

/* Botones de demostración */
.demo-btn {
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.demo-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.3);
}

.demo-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.create-demo {
    text-align: center;
}

#generated-xml {
    text-align: left;
    margin: 1.5rem 0;
}

/* Tabla comparativa */
.comparison-table {
    overflow-x: auto;
    margin: 2rem 0;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.comparison-table th {
    background: #8b5cf6;
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.comparison-table td {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table tr:hover td {
    background: #f5f3ff;
}

.comparison-table code {
    background: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: #334155;
}

/* Área de práctica */
.practice-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.practice-controls {
    background: #f8fafc;
    border-radius: 10px;
    padding: 1.5rem;
}

.practice-controls h3 {
    color: #1e293b;
    margin-bottom: 1rem;
}

/* Editores de código - FONDO OSCURO */
.xml-editor, .php-editor {
    width: 100%;
    height: 200px;
    padding: 1rem;
    border: 2px solid #334155;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    background: #1e293b;
    color: #e2e8f0;
    margin-bottom: 1rem;
    resize: vertical;
    line-height: 1.5;
}

.php-editor {
    height: 250px;
}

.practice-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #8b5cf6;
    color: white;
}

.btn-primary:hover {
    background: #7c3aed;
    transform: translateY(-2px);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.btn-secondary:hover {
    background: #cbd5e1;
    transform: translateY(-2px);
}

.practice-result {
    background: #f8fafc;
    border-radius: 10px;
    padding: 1.5rem;
}

.practice-result h3 {
    color: #1e293b;
    margin-bottom: 1rem;
}

/* Área de salida - FONDO OSCURO */
.output-area {
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 6px;
    padding: 1rem;
    min-height: 200px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    overflow-x: auto;
}

.output-area pre {
    margin: 0;
    color: #e2e8f0;
    background: transparent;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Consejos */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.tip {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid #8b5cf6;
    transition: transform 0.3s ease;
}

.tip:hover {
    transform: translateY(-5px);
}

.tip i {
    font-size: 2rem;
    color: #8b5cf6;
    margin-bottom: 1rem;
}

.tip h3 {
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.tip p {
    color: #475569;
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
}

.tip code {
    background: #e2e8f0;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: #334155;
}

/* Resultado explorado */
.explored-result {
    margin-top: 1rem;
}

/* Estilos generales para código - FONDO OSCURO */
pre {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    border: 1px solid #334155;
}

code {
    background: transparent;
    color: inherit;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* Resaltado de sintaxis para XML */
.xml-tag {
    color: #f87171;
}

.xml-attr {
    color: #60a5fa;
}

.xml-value {
    color: #34d399;
}

/* Tooltip */
.xml-tooltip {
    position: fixed;
    background: #8b5cf6;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    animation: fadeIn 0.3s ease;
}

/* Notificaciones */
.dom-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.dom-notification.success {
    background: #10b981;
}

.dom-notification.info {
    background: #8b5cf6;
}

.dom-notification.error {
    background: #ef4444;
}

/* Animaciones */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

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

/* Responsive */
@media (max-width: 1024px) {
    .article-title {
        font-size: 2.5rem;
    }
    
    .content-section h2 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .tutorial-article {
        padding: 1rem;
    }
    
    .code-comparison,
    .interactive-demo,
    .structure-explanation,
    .practice-container {
        grid-template-columns: 1fr;
    }
    
    .demo-arrow {
        transform: rotate(90deg);
        margin: 1rem 0;
    }
    
    .article-title {
        font-size: 2rem;
    }
    
    .header-stats {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .stat {
        justify-content: center;
    }
    
    .content-section {
        padding: 1.5rem;
    }
    
    .content-section h2 {
        font-size: 1.8rem;
    }
    
    .method-card {
        padding: 1rem;
    }
    
    .tips-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .article-title {
        font-size: 1.8rem;
    }
    
    .article-subtitle {
        font-size: 1.1rem;
    }
    
    .content-section h2 {
        font-size: 1.5rem;
    }
    
    .tree-node {
        font-size: 0.8rem;
    }
    
    .practice-buttons {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .demo-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Estilos para scrollbars (opcional, para mejor apariencia) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #8b5cf6;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #7c3aed;
}

/* Para Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #8b5cf6 #f1f5f9;
}
