/* Estilos específicos para el ejemplo de Semáforo */
.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, .control-structures-section, .use-cases-section, .concepts-section, .exercise-section, .navigation-section {
    margin-bottom: 3rem;
}

.demo-section h2, .explanation-section h2, .control-structures-section h2, .use-cases-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;
}

/* Semáforo */
.semaforo-container {
    text-align: center;
}

.semaforo {
    background: #2c3e50;
    width: 120px;
    height: 320px;
    margin: 0 auto 2rem;
    border-radius: 60px;
    padding: 20px;
    position: relative;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    border: 5px solid #34495e;
}

.luz {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 20px;
    background: #3a3a3a;
    border: 3px solid #2c2c2c;
    transition: all 0.3s ease;
    position: relative;
}

.luz:last-child {
    margin-bottom: 0;
}

.luz.activa {
    box-shadow: 0 0 20px 10px;
}

.luz-rojo.activa {
    background: #e74c3c;
    border-color: #c0392b;
    box-shadow: 0 0 20px 10px rgba(231, 76, 60, 0.5);
}

.luz-amarillo.activa {
    background: #f39c12;
    border-color: #d35400;
    box-shadow: 0 0 20px 10px rgba(243, 156, 18, 0.5);
}

.luz-verde.activa {
    background: #2ecc71;
    border-color: #27ae60;
    box-shadow: 0 0 20px 10px rgba(46, 204, 113, 0.5);
}

.mensaje-semaforo {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 3px solid;
    text-align: center;
    transition: all 0.3s ease;
}

.mensaje-semaforo.verde {
    border-color: #2ecc71;
    background: linear-gradient(135deg, #f8fff8, #e8f6ef);
}

.mensaje-semaforo.amarillo {
    border-color: #f39c12;
    background: linear-gradient(135deg, #fffbf0, #fef9e7);
}

.mensaje-semaforo.rojo {
    border-color: #e74c3c;
    background: linear-gradient(135deg, #fff5f5, #fdedec);
}

.mensaje-semaforo.invalido {
    border-color: #7f8c8d;
    background: linear-gradient(135deg, #f8f9fa, #ecf0f1);
}

.color-indicador {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.instruccion {
    font-size: 1.3rem;
    font-weight: bold;
}

.mensaje-semaforo.verde .instruccion {
    color: #27ae60;
}

.mensaje-semaforo.amarillo .instruccion {
    color: #d35400;
}

.mensaje-semaforo.rojo .instruccion {
    color: #c0392b;
}

.mensaje-semaforo.invalido .instruccion {
    color: #7f8c8d;
}

/* 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-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s;
}

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

.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-colors {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e1e8ed;
}

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

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

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

.quick-btn.verde {
    background: #27ae60;
}

.quick-btn.verde:hover {
    background: #2ecc71;
}

.quick-btn.amarillo {
    background: #f39c12;
}

.quick-btn.amarillo:hover {
    background: #f1c40f;
}

.quick-btn.rojo {
    background: #c0392b;
}

.quick-btn.rojo:hover {
    background: #e74c3c;
}

.quick-btn:hover {
    transform: translateY(-2px);
}

/* Semáforo automático */
.auto-semaforo {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e1e8ed;
}

.auto-semaforo h4 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

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

.auto-btn:hover {
    background: #2980b9;
}

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

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

.auto-info {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
    text-align: center;
}

/* Comparación de métodos */
.comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.comparison-method {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
}

.comparison-method h5 {
    color: #8e44ad;
    margin-top: 0;
    margin-bottom: 1rem;
    text-align: center;
}

.comparison-method pre {
    margin: 0;
    white-space: pre-wrap;
}

.comparison-method code {
    font-family: 'Courier New', monospace;
    color: #2c3e50;
}

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

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

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

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

.structure-example pre {
    margin: 0;
    white-space: pre-wrap;
}

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

.structure-pros h4 {
    color: #27ae60;
    margin-bottom: 0.5rem;
}

.structure-pros ul {
    margin: 0;
    padding-left: 1.5rem;
}

.structure-pros li {
    margin-bottom: 0.3rem;
    line-height: 1.4;
}

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

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

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

.use-case p {
    color: #7f8c8d;
    margin-bottom: 1rem;
}

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

/* 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: 3000px;
}

.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;
    }
    
    .structures-grid {
        grid-template-columns: 1fr;
    }
    
    .use-cases-grid {
        grid-template-columns: 1fr;
    }
    
    .concepts-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .comparison {
        grid-template-columns: 1fr;
    }
    
    .nav-buttons {
        flex-direction: column;
    }
    
    .example-title {
        font-size: 1.8rem;
    }
    
    .code-breakdown {
        padding: 1rem;
    }
    
    .explanation-point {
        padding: 1rem;
    }
    
    .semaforo {
        width: 100px;
        height: 280px;
    }
    
    .luz {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .quick-buttons {
        grid-template-columns: 1fr;
    }
    
    .semaforo {
        width: 80px;
        height: 240px;
    }
    
    .luz {
        width: 50px;
        height: 50px;
        margin-bottom: 15px;
    }
}