/* Estilos generales */
:root {
    --primary-color: #0d47a1; /* Updated to a vibrant blue */
    --secondary-color: #42a5f5; /* Updated to a lighter blue */
    --light-color: #ffffff; /* Changed to pure white for better contrast */
    --dark-color: #212121; /* Updated to a darker gray */
    --code-bg: #263238; /* Updated to a dark teal for better readability */
    --code-color: #eceff1; /* Updated to a light gray for better contrast */
    --comment-color: #81c784; /* Updated to a soft green */
    --keyword-color: #ffab40; /* Updated to a bright orange */
    --string-color: #ff7043; /* Updated to a coral color */
    --number-color: #ffd54f; /* Updated to a golden yellow */
    --function-color: #64b5f6; /* Updated to a sky blue */
    --variable-color: #4db6ac; /* Updated to a teal */
    --php-tag-color: #90a4ae; /* Updated to a muted blue-gray */
    --line-number-color: #b0bec5; /* Updated to a light blue-gray */
    --button-copy-bg: #37474f; /* Updated to a dark slate */
    --button-copy-hover: #455a64; /* Updated to a slightly lighter slate */
    --button-run-bg: #1e88e5; /* Updated to a bold blue */
    --button-run-hover: #1976d2; /* Updated to a deeper blue */
    --button-success-bg: #43a047; /* Updated to a vibrant green */
    --tooltip-bg: #424242; /* Updated to a dark gray */
    --tooltip-color: #fafafa; /* Updated to a very light gray */
    --button-transition: all 0.3s ease-in-out; /* Slightly increased transition time */
    --button-copy-text: #cfd8dc; /* Updated to a light blue-gray */
    --button-copy-hover-text: #ffffff; /* Kept as white for contrast */
    --button-run-text: #ffffff; /* Kept as white for contrast */
    --button-success-text: #ffffff; /* Kept as white for contrast */
}

body {
    padding-top: 60px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
}

/* Hero section mejorado */
.hero-section {
    min-height: 600px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    margin-top: -60px; /* Compensar el padding-top del body */
    padding-top: 60px; /* Espacio para la barra de navegación */
}

@media (max-width: 768px) {
    .hero-section {
        min-height: 500px;
    }
    .hero-section h1 {
        font-size: 2.5rem !important;
    }
    .hero-section p.lead {
        font-size: 1.2rem !important;
    }
    .hero-section .btn {
        padding: 0.5rem 1rem !important;
        font-size: 1rem !important;
    }
}

.wave-bottom {
    position: absolute;
    bottom: -2px; /* Evita espacio en blanco entre la ola y el contenido siguiente */
    left: 0;
    width: 100%;
    line-height: 0;
}

.hero-section .btn {
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.hero-section .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.hero-section .btn-light {
    background-color: #fff;
    color: var(--primary-color);
    border-color: #fff;
}

.hero-section .btn-light:hover {
    background-color: #f8f9fa;
}

.hero-section .btn-outline-light {
    color: #fff;
    border-color: #fff;
}

.hero-section .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Navegación */
.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand i {
    color: var(--primary-color);
}

/* Contenido */
.card {
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

h1, h2, h3, h4, h5, h6 {
    color: #021839; /* Changed to white */
    margin-bottom: 20px;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Ejemplos de código */
pre {
    background-color: var(--code-bg);
    color: var(--code-color);
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
    overflow-x: auto;
}

code {
    font-family: 'Consolas', 'Courier New', monospace;
}

/* Editor estilo VS Code con botones "Copiar" y "Ejecutar" */
.vscode-editor {
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background-color: var(--code-bg);
    margin-bottom: 20px;
    border: 1px solid #3c3c3c;
    position: relative;
}

.vscode-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #252526;
    padding: 8px 10px;
    border-bottom: 1px solid #343a40;
}

.vscode-editor-content {
    padding: 0;
    overflow-x: auto;
    background-color: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Courier New', monospace;
    position: relative;
    display: flex;
}

.vscode-editor-content pre {
    margin: 0;
    padding: 15px;
    background-color: transparent;
    overflow-x: visible;
    flex-grow: 1;
}

.vscode-editor-content code {
    font-size: 0.9rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    white-space: pre;
}

/* Numeración de líneas */
.line-numbers {
    user-select: none;
    text-align: right;
    padding: 15px 8px 15px 15px;
    color: var(--line-number-color);
    background-color: #1e1e1e;
    border-right: 1px solid #3c3c3c;
    min-width: 40px;
}

.line-numbers span {
    display: block;
    font-size: 0.9rem;
    line-height: 1.5;
}

.line-number {
    display: block;
    padding: 0 5px;
    line-height: 1.5;
    font-size: 0.85rem;
}

.vscode-editor-footer {
    padding: 6px 10px;
    background-color: #252526;
    color: #666;
    font-size: 0.8rem;
    border-top: 1px solid #3c3c3c;
    display: flex;
    justify-content: space-between;
}

/* Líneas de código con mejor espacio vertical */
.line {
    line-height: 1.5;
    min-height: 1.5em;
    display: block;
    position: relative;
}

.line:hover {
    background-color: #2a2d2e;
}

/* Estilos de colores para código PHP */
.php-tag {
    color: var(--php-tag-color);
}

.php-keyword {
    color: var(--keyword-color);
}

.php-string {
    color: var(--string-color);
}

.php-number {
    color: var(--number-color);
}

.php-variable {
    color: var(--variable-color);
}

.php-function {
    color: var(--function-color);
}

.php-comment {
    color: var(--comment-color);
}

/* Panel de resultados */
.result-panel {
    background: #f8f9fa;
    border-left: 4px solid #0d6efd;
    font-family: 'Courier New', monospace;
    border: 1px solid #4CAF50;
    border-radius: 5px;
    padding: 15px;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.result-header {
    font-weight: bold;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ddd;
}

.result-output {
    padding: 10px;
    background-color: #fff;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'Consolas', 'Courier New', monospace;
}

/* Animación para el botón de copiar */
.vscode-editor-btn.copy.copied {
    background-color: #28a745;
    color: white;
}

/* Animación para la carga */
.loading {
    display: inline-block;
    position: relative;
    padding-left: 20px;
}

.loading:after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border-radius: 50%;
    border: 2px solid #666;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Navegación entre páginas */
.page-navigation {
    margin: 30px 0;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

/* Footer */
footer {
    margin-top: 50px;
}

/* Responsividad */
@media (max-width: 768px) {
    .vscode-editor-btn span {
        display: none;
    }
    
    .vscode-editor-title .icon {
        margin-right: 4px;
    }
    
    .vscode-editor-title .tab {
        font-size: 0.8rem;
    }
}

/* Estilos para las tarjetas con efecto hover */
.hover-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}

/* Estilos para los encabezados con gradiente */
.bg-gradient-light {
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
}

/* Editor de código estilo VS Code - Versión mejorada */
.vscode-wrapper {
    margin-bottom: 30px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.vscode-editor {
    background-color: var(--code-bg);
    border: 1px solid #dee2e6;
    border-radius: 4px 4px 0 0;
    font-family: 'Consolas', 'Courier New', monospace;
}

/* Barra de título del editor */
.vscode-titlebar {
    display: flex;
    background-color: #252526;
    padding: 4px 8px;
    border-bottom: 1px solid #3c3c3c;
}

.vscode-window-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 10px;
}

.window-control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.window-control.close {
    background-color: #ff5f57;
}

.window-control.minimize {
    background-color: #febc2e;
}

.window-control.maximize {
    background-color: #28c940;
}

/* Pestañas */
.vscode-tabs {
    display: flex;
    flex-grow: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

.vscode-tabs::-webkit-scrollbar {
    display: none;
}

.vscode-tab {
    display: flex;
    align-items: center;
    padding: 4px 10px;
    background-color: #2d2d2d;
    color: #cccccc;
    font-size: 0.8rem;
    border-right: 1px solid #3c3c3c;
    cursor: pointer;
    white-space: nowrap;
}

.vscode-tab.active {
    background-color: #1e1e1e;
    color: white;
    border-bottom: none;
}

.tab-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px;
}

.php-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='%23777BB4' d='M16 4.925L2.618 10.5 16 16.075 29.382 10.5 16 4.925z'/%3E%3Cpath fill='%23777BB4' d='M13.244 17.993l-10.627-5.432v10.44l10.623 5.43 10.626-5.43v-10.44l-10.623 5.432z'/%3E%3C/svg%3E");
}

.tab-name {
    margin-right: 8px;
}

.tab-close {
    color: #8c8c8c;
    font-size: 1.2rem;
    line-height: 1;
    margin-left: 4px;
}

/* Área principal del editor */
.vscode-main {
    position: relative;
}

.vscode-editor-area {
    display: flex;
    background-color: #1e1e1e;
}

.line-numbers {
    user-select: none;
    text-align: right;
    padding: 10px 0;
    color: #6e6e6e;
    background-color: #1e1e1e;
    font-size: 0.9rem;
    min-width: 40px;
    border-right: 1px solid #3c3c3c;
}

.line-number {
    display: block;
    padding: 0 10px;
    line-height: 1.5;
}

.code-content {
    flex-grow: 1;
    padding: 10px 0 10px 15px;
    overflow-x: auto;
}

.code-line {
    line-height: 1.5;
    white-space: pre;
    padding-right: 15px;
}

/* Barra de estado */
.vscode-statusbar {
    display: flex;
    justify-content: space-between;
    background-color: #007acc;
    color: white;
    font-size: 0.75rem;
    padding: 2px 10px;
}

.status-left, .status-right {
    display: flex;
    align-items: center;
}

.status-item {
    margin-right: 10px;
    display: flex;
    align-items: center;
}

.status-item:before {
    content: '';
    display: inline-block;
    width: 1px;
    height: 1em;
    background-color: rgba(255, 255, 255, 0.4);
    margin: 0 10px;
}

.status-item:first-child:before {
    display: none;
}

/* Botones de acción */
.vscode-action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px;
    background-color: #252526;
    border-top: 1px solid #3c3c3c;
}

.copy-code-btn, .run-code-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-code-btn {
    background-color: #3c3c3c;
    color: #cccccc;
}

.copy-code-btn:hover {
    background-color: #4e4e4e;
}

.run-code-btn {
    background-color: #0e639c;
    color: white;
}

.run-code-btn:hover {
    background-color: #1177bb;
}

.copy-code-btn:active, .run-code-btn:active {
    transform: translateY(1px);
}

/* Terminal para mostrar resultados */
.vscode-terminal {
    background-color: #1e1e1e;
    border-top: 1px solid #3c3c3c;
    color: white;
    font-family: 'Consolas', 'Courier New', monospace;
    border-radius: 0 0 4px 4px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.vscode-terminal.active {
    max-height: 300px;
    opacity: 1;
    overflow-y: auto;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.terminal-header {
    background-color: #252526;
    padding: 5px 10px;
    font-size: 0.85rem;
    color: #cccccc;
    border-bottom: 1px solid #3c3c3c;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.terminal-close {
    background: none;
    border: none;
    color: #8c8c8c;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 5px;
}

.terminal-close:hover {
    color: #f5f5f5;
}

.terminal-content {
    padding: 10px;
    font-size: 0.9rem;
}

.terminal-prompt {
    color: #0f0;
    margin-bottom: 5px;
}

.terminal-output {
    color: white;
    white-space: pre-wrap;
}

.result-updated {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* Animación de aparición para la terminal */
@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 300px;
        opacity: 1;
    }
}

.terminal-show {
    animation: slideDown 0.3s ease-out forwards;
}

/* Resaltado de sintaxis */
.php-tag {
    color: var(--php-tag-color);
}

.php-keyword {
    color: var(--keyword-color);
}

.php-string {
    color: var(--string-color);
}

.php-number {
    color: var(--number-color);
}

.php-variable {
    color: var(--variable-color);
}

.php-function {
    color: var(--function-color);
}

.php-comment {
    color: var(--comment-color);
}

/* Responsive design */
@media (max-width: 768px) {
    .vscode-tab .tab-name {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .status-item {
        margin-right: 5px;
    }
    
    .status-item:before {
        margin: 0 5px;
    }
    
    .copy-code-btn span, .run-code-btn span {
        display: none;
    }
}

@media (max-width: 576px) {
    .vscode-editor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .vscode-editor-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .vscode-editor-btn {
        flex: 1;
    }
}

/* Estilos para la línea de tiempo de evolución de PHP */
.timeline-container {
    width: 100%;
    padding: 20px 0;
    margin: 30px 0;
    position: relative;
}

.timeline {
    position: relative;
    padding: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background-color: #0d6efd;
    z-index: 1;
}

.timeline-item {
    width: 100%;
    margin-bottom: 60px;
    position: relative;
}

.timeline-item:nth-child(even) {
    padding-left: 50%;
}

.timeline-item:nth-child(odd) {
    padding-right: 50%;
    text-align: right;
}

.timeline-dot {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #0d6efd;
    z-index: 2;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.2);
}

.timeline-content {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    width: 90%;
}

.timeline-item:nth-child(even) .timeline-content {
    margin-left: 40px;
}

.timeline-item:nth-child(odd) .timeline-content {
    margin-right: 40px;
}

.timeline-content::after {
    content: attr(data-year);
    position: absolute;
    top: -25px;
    font-weight: bold;
    color: #212529;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
}

.timeline-item:nth-child(even) .timeline-content::after {
    left: 0;
}

.timeline-item:nth-child(odd) .timeline-content::after {
    right: 0;
}

.timeline-content h5 {
    margin-top: 0;
    color: #0d6efd;
}

/* Estilos responsivos para dispositivos móviles */
@media (max-width: 768px) {
    .timeline::before {
        left: 40px;
    }
    
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        padding-left: 80px;
        padding-right: 0;
        text-align: left;
    }
    
    .timeline-dot {
        left: 40px;
    }
    
    .timeline-content {
        width: calc(100% - 50px);
    }
    
    .timeline-item:nth-child(odd) .timeline-content,
    .timeline-item:nth-child(even) .timeline-content {
        margin-left: 0;
        margin-right: 0;
    }
    
    .timeline-item:nth-child(odd) .timeline-content::after {
        left: 0;
        right: auto;
    }
}

/* Estilos responsivos para dispositivos móviles */
@media (max-width: 768px) {
    /* Timeline centrado para móviles */
    .timeline-item {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-bottom: 40px;
    }
    
    .timeline-item .timeline-content {
        width: 80% !important;
        margin: 0 auto !important;
        margin-top: 30px !important;
    }

    .timeline-item.d-flex {
        display: block !important;
    }
    
    .timeline-item .timeline-badge {
        left: 50% !important;
    }

    /* Animaciones para móviles */
    .timeline-item.animate__fadeInLeft,
    .timeline-item.animate__fadeInRight {
        animation-name: animate__fadeInUp !important;
    }
}

/* Estilos adicionales para el ejercicio práctico */
.accordion-button:not(.collapsed) {
    background-color: #e7f1ff;
    color: #0d6efd;
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}