/* Estilos específicos para el ejemplo de Recorrido de Números */
.example-article {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.example-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #ecf0f1;
}

.breadcrumb {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 1rem;
}

.breadcrumb a {
    color: #8e44ad;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.example-title {
    font-size: 2.2rem;
    color: #8e44ad;
    margin-bottom: 1rem;
    font-weight: 300;
}

.example-subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
}

/* Secciones */
.demo-section, .explanation-section, .loops-section, .operators-section, .patterns-section, .concepts-section, .exercise-section, .navigation-section {
    margin-bottom: 3rem;
}

.demo-section h2, .explanation-section h2, .loops-section h2, .operators-section h2, .patterns-section h2, .concepts-section h2, .exercise-section h2 {
    color: #8e44ad;
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ecf0f1;
}

/* Demo container */
.demo-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    border: 2px dashed #8e44ad;
}

/* Grid de números */
.numbers-container {
    text-align: center;
}

.numbers-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.number-cell {
    position: relative;
    background: #3498db;
    color: white;
    padding: 1.5rem 0.5rem;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.number-cell:nth-child(even) {
    background: #2980b9;
}

.number-cell.encontrado {
    background: #2ecc71;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
    z-index: 1;
}

.number {
    font-size: 1.4rem;
}

.target-indicator {
    font-size: 1rem;
    margin-top: 0.25rem;
    animation: pulse 2s infinite;
}

/* Resumen de resultados */
.results-summary {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 2px solid #e1e8ed;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #ecf0f1;
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    color: #2c3e50;
    font-weight: 500;
}

.result-value {
    font-weight: bold;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.result-value.target {
    background: #f39c12;
    color: white;
}

.result-value.encontrado {
    background: #2ecc71;
    color: white;
}

/* Formulario interactivo */
.demo-form {
    background: white;
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #8e44ad;
    box-shadow: 0 0 0 2px rgba(142, 68, 173, 0.2);
}

.input-hint {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 0.25rem;
}

.demo-button {
    background: #8e44ad;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
    margin-top: 0.5rem;
}

.demo-button:hover {
    background: #9b59b6;
}

/* Botones rápidos */
.quick-targets {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e1e8ed;
}

.quick-targets h4 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

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

.quick-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.quick-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* Animación de búsqueda */
.search-animation {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e1e8ed;
}

.search-animation h4 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

.animation-btn {
    background: #f39c12;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    width: 100%;
    margin-bottom: 1rem;
}

.animation-btn:hover {
    background: #e67e22;
}

.animation-btn.running {
    background: #e74c3c;
}

.animation-btn.running:hover {
    background: #c0392b;
}

.animation-container {
    min-height: 100px;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 1rem;
    border: 1px dashed #bdc3c7;
}

/* Flujo de ejecución */
.execution-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.flow-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border: 2px solid #8e44ad;
    width: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.step-number {
    background: #8e44ad;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.step-description {
    flex: 1;
    font-size: 1rem;
}

.flow-arrow {
    color: #8e44ad;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Grid de bucles */
.loops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

.loop-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

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

.loop-card h3 {
    color: #8e44ad;
    margin-top: 0;
    margin-bottom: 1rem;
    text-align: center;
}

.loop-syntax {
    background: #2c3e50;
    color: white;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.loop-syntax pre {
    margin: 0;
    white-space: pre-wrap;
}

.loop-syntax code {
    color: #ecf0f1;
    font-family: 'Courier New', monospace;
}

.loop-use-case h4 {
    color: #27ae60;
    margin-bottom: 0.5rem;
}

.loop-use-case ul {
    margin: 0;
    padding-left: 1.5rem;
}

.loop-use-case li {
    margin-bottom: 0.3rem;
    line-height: 1.4;
}

/* Tabla de operadores */
.operators-table {
    overflow-x: auto;
    margin-top: 1.5rem;
}

.operators-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

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

.operators-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: top;
}

.operators-table tr:hover {
    background: #f8f9fa;
}

.operators-table code {
    background: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

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

.pattern-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.pattern-card h3 {
    color: #8e44ad;
    margin-top: 0;
    margin-bottom: 1rem;
}

.pattern-code {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.pattern-card p {
    color: #7f8c8d;
    margin: 0;
    line-height: 1.5;
}

/* Explicación del código */
.code-breakdown {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
}

.code-block {
    background: #2c3e50;
    color: white;
    padding: 1.5rem;
    border-radius: 6px;
    margin-bottom: 2rem;
}

.code-block h3 {
    color: #ecf0f1;
    margin-top: 0;
    margin-bottom: 1rem;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
}

.code-block code {
    color: #ecf0f1;
    font-family: 'Courier New', monospace;
}

.explanation-points {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.explanation-point {
    background: white;
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid #8e44ad;
}

.explanation-point h4 {
    color: #8e44ad;
    margin-top: 0;
    margin-bottom: 1rem;
}

.code-line {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    border-left: 3px solid #8e44ad;
    font-family: 'Courier New', monospace;
    color: #2c3e50;
    font-weight: bold;
    line-height: 1.8;
}

.concept-box {
    background: #e8f4fd;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
    border-left: 3px solid #3498db;
}

.concept-box h5 {
    color: #3498db;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

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

.concept-card {
    background: white;
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.concept-card h3 {
    color: #8e44ad;
    margin-top: 0;
    margin-bottom: 1rem;
}

.concept-card ul {
    margin: 0;
    padding-left: 1.5rem;
}

.concept-card li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Ejercicio */
.exercise {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
}

.exercise h3 {
    color: #8e44ad;
    margin-top: 0;
}

.exercise ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.exercise li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.solution-toggle {
    margin-top: 1.5rem;
}

.toggle-button {
    background: #8e44ad;
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    width: 100%;
}

.toggle-button:hover {
    background: #9b59b6;
}

.solution-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: white;
    margin-top: 1rem;
    border-radius: 4px;
}

.solution-content.expanded {
    max-height: 4000px;
}

.solution {
    padding: 1.5rem;
    border-bottom: 1px solid #ecf0f1;
}

.solution:last-child {
    border-bottom: none;
}

.solution h4 {
    color: #8e44ad;
    margin-top: 0;
    margin-bottom: 1rem;
}

/* Navegación */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.nav-button {
    display: inline-block;
    padding: 1rem 1.5rem;
    background: #8e44ad;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
    text-align: center;
    flex: 1;
}

.nav-button:hover {
    background: #9b59b6;
    text-decoration: none;
    color: white;
}

.nav-button.prev {
    background: #7f8c8d;
}

.nav-button.prev:hover {
    background: #95a5a6;
}

/* Responsive */
@media (max-width: 768px) {
    .example-article {
        padding: 1rem;
    }
    
    .demo-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    
    .numbers-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .number-cell {
        padding: 1rem 0.25rem;
        min-height: 50px;
    }
    
    .loops-grid {
        grid-template-columns: 1fr;
    }
    
    .patterns-grid {
        grid-template-columns: 1fr;
    }
    
    .concepts-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-buttons {
        grid-template-columns: 1fr;
    }
    
    .nav-buttons {
        flex-direction: column;
    }
    
    .example-title {
        font-size: 1.8rem;
    }
    
    .code-breakdown {
        padding: 1rem;
    }
    
    .explanation-point {
        padding: 1rem;
    }
    
    .flow-step {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .numbers-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .operators-table {
        font-size: 0.8rem;
    }
    
    .number {
        font-size: 1.2rem;
    }
}