:root {
    --primary-color: #4a6bff;
    --secondary-color: #1c2566;
    --dark-color: #1a1a2e;
    --light-color: #f8f9fa;
    --shadow-color: rgba(28, 37, 102, 0.2);
    --success-color: #a72828;
    --card-bg: #ffffff;
    --animacionMenu: #ffffff;
     
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    width: 98%;              /* Más ancho en pantallas grandes */
    max-width: 1600px;       /* Aumenta el máximo a 1600px */
    margin: 0 auto;
    padding: 0 30px;         /* Más espacio lateral */
}

.main-content {
    display: flex;
    gap: 30px;
    margin: 30px auto;
}

/* PRIMER CONTENEDOR */
.main-header {
    background: linear-gradient(135deg, #fefefe 0%, #6ab1f8 50%, #439DF7 100%);
    padding: 3rem 0;
    text-align: center;
    margin-bottom: 2rem;
    border-radius: 10px;
    color: #f9faff;
}

.main-header h1 {
    font-size: 2.8rem;
    margin-bottom: 0.5rem;
}

.main-header p {
    font-size: 1.2rem;
    color: var(--dark-color)
}

/* Navigation */
.main-nav {
    background-color: var(--animacionMenu);
    border: 1px solid #000000;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 5px 15px var(--shadow-color);
    backdrop-filter: blur(8px);
    margin-bottom: 30px;
    border-radius: 8px;
}

.main-nav ul {
    display: flex;
    list-style: none;
    justify-content: center;
    padding: 1rem 0;
    flex-wrap: wrap;
}

.main-nav li {
    margin: 0 1rem;
}
/* Menu de contenido y color */
.main-nav a {
    color: rgb(0, 0, 0);
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* cambio de color animacion de menu */
.main-nav a:hover {
    background-color: hsl(210, 73%, 62%);
    color: rgb(0, 0, 0);
    transform: translateY(-2px);
}

/* Sidebar */
.sidebar {
    flex: 0 0 280px;
    position: sticky;
    top: 120px;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.resource-card, .newsletter-card, .tip-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 5px 20px var(--shadow-color);
}

.resource-card h3, .newsletter-card h3, .tip-card h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.resource-list {
    list-style: none;
}

.resource-list li {
    margin-bottom: 0.8rem;
}

.resource-list a {
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
    padding: 0.3rem 0;
}

.resource-list a:hover {
    color: var(--secondary-color);
}

.newsletter-card input {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-family: inherit;
}

.newsletter-card button {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.newsletter-card button:hover {
    background-color: var(--secondary-color);
}

.tip-card p {
    line-height: 1.5;
}

.tip-card code {
    background: #f0f4ff;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

/*Para dar formato a los códigos en el resto del doc*/
code {
    background: #f0f4ff;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

/* Main Content */
main {
    flex: 1;
}

.section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 25px var(--shadow-color);
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(28, 37, 102, 0.25);
}

.section h2 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.article {
    margin-bottom: 2.5rem;
}

.article h3 {
    color: var(--primary-color);
    margin: 1.8rem 0 1.2rem;
    font-size: 1.5rem;
}

/* Modelo de Caja Interactivo */

.parrafo-sencillo {
    text-align: justify;
}

.interactive-box-model {
    background-color: #f0f4ff;
    border: 2px dashed var(--primary-color);
    padding: 30px;
    margin: 40px auto;
    max-width: 500px;
    position: relative;
    transition: all 0.3s ease;
}

.box-content-example {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s ease;
}

.box-model-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.box-model-controls button {
    padding: 0.6rem 1.2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.box-model-controls button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.box-model-explanation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.box-model-part {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    text-align: justify;
}

.box-model-editor-codigo {
    display: grid;
    margin-top: 30px;
}

.box-model-part h4 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.lista {
    margin-left: 50px;
}

ol li::marker {
  font-weight: bold;
}

.ejemplos-codigos {
    background-color:#fbfafa;
    padding: 1.5rem;
    border:2px;
    border-color: #201a1a;
    border-radius: 8px;
    margin-top: 1.5rem;
    text-align:left;
}

/* Flexbox vs Grid */
.layout-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
}

.layout-example {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
}

.flex-container-example {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    background: #f0f4ff;
    margin-bottom: 15px;
}

.flex-item {
    background: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
}

.grid-container-example {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 15px;
    background: #f0f4ff;
    margin-bottom: 15px;
}

.grid-item {
    background: var(--secondary-color);
    color: white;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
}

.use-cases {
    background: #e9eff6;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    text-align:center;
}

.use-cases h4 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.use-cases ul {
    padding-left: 1.5rem;
}

.use-cases li {
    margin-bottom: 0.8rem;
}

.comparacion button {
    position: relative;
    margin: 0.5rem;
    padding: 0.6rem 1.2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.comparacion button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
}

.comparacion button::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 26px;
  right: 0px;
  background-color: #6ab1f8;
  color: #fff;
  padding: 5px 10px;
  border-radius: 5px;
  display: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.comparacion button:hover::after {
  display: block;
  opacity: 1;
}

/* estilos de las tarjetas-------------------------------------------------------------------------------- */


/* Contenedor principal de las tarjetas */
.cards {
    display: flex;
    /* Usa Flexbox para organizar las tarjetas */
    justify-content: center;
    /* IGUAL Centra las tarjetas horizontalmente */
    align-items: center;
    /* IGUAL Centra las tarjetas verticalmente */
    gap: 2px;
    /* Espacio entre las tarjetas */
    padding: 10px;
    /* Espaciado interno del contenedor */
    flex-wrap: wrap;
    /* IGUAL Permite que las tarjetas pasen a la siguiente línea si no caben */
}

/* Estilos básicos para cada tarjeta */
.cards .fcard {
    background-color: transparent;
    /* Fondo transparente para permitir efecto visual */
    width: 350px;
    /* Ancho fijo de la tarjeta */
    height: 350px;
    /* Altura fija de la tarjeta */
    border: solid 1px #ffffff;
    /* Borde blanco */
    perspective: 1000px;
    /* Perspectiva para efecto 3D */
    display: flex;
    align-items: center;
    /* Alinea elementos internos verticalmente (aunque no tendrá efecto aquí sin display:flex) */
}

/* Contenedor interno que se voltea al hacer hover */
.cards .fcard .inner {
    position: relative;
    /* Posicionamiento relativo para controlar otras posiciones de elementos */
    width: 100%;
    height: 100%;
    text-align: center;
    /* Centra el contenido horizontalmente */
    transition: transform 1.5s ease-in-out;
    /* Transición suave al girar */
    transform-style: preserve-3d;
    /* Mantiene el efecto 3D de los hijos */
}

/* Efecto al pasar el cursor: gira la tarjeta */
.cards .fcard:hover .inner {
    transform: rotateY(180deg);
    /* Rota la tarjeta en el eje Y */
}

/* Cara frontal de la tarjeta */
.cards .fcard .pfrente {
    position: absolute;
    /* Posicionamiento absoluto para superponer caras */
    width: 90%;
    height: 90%;
    backface-visibility: hidden;
    /* Oculta el reverso cuando se gira */
    background-color: #190d0d;
    /* Color de fondo oscuro */
    color: #333;
    /* Color del texto */
}

/* Cara trasera de la tarjeta */
.cards .fcard .ptrasera {
    position: absolute;
    /* Igual a la cara frontal */
    width: 90%;
    height: 90%;
    backface-visibility: hidden;
    /* Oculta el reverso cuando no está de frente */
    background-color: #fcf9f9;
    /* Fondo azul brillante */
    box-shadow: 0 5px 15px var(--shadow-color);
    /* Efecto de sombra en los bordes */
    color: #333;
    /* Color del texto oscuro */
    transform: rotateY(180deg);
    /* Rota esta cara para que quede visible cuando la tarjeta gira */
    display: flex;
    align-items: center;
    flex-direction: column;
    text-align: left;
}

.lista-tarjetas {
    margin-left: 50px;
    text-align: left;
}

/* Imagen dentro de la cara frontal */
.cards .fcard .pfrente img {
    width: 100%;
    /* Imagen ocupa todo el ancho del contenedor */
    height: 100%;
    /* Imagen ocupa toda la altura del contenedor */
} 

/* Animaciones */
.transition-example {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.transition-box {
    width: 150px;
    height: 100px;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.hover-me:hover {
    transform: translateY(-10px);
    background: var(--secondary-color);
}

.click-me:active {
    transform: scale(0.95);
    background: #ff6b6b;
}

.animation-examples {
    display: flex;
    gap: 20px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.animated-box {
    width: 100px;
    height: 100px;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.bounce {
    animation: bounce 1s infinite alternate;
}

.rotate {
    animation: rotate 3s infinite linear;
}

.pulse {
    animation: pulse 1.5s infinite ease-in-out;
}

.keyframe-explanation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.animation-properties {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.animation-properties ul {
    padding-left: 1.2rem;
}

.animation-properties li {
    margin-bottom: 0.7rem;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-20px); }
}

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

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


/* Footer */
.main-footer {
    background-color: var(--dark-color);
    color: white;
    text-align: center;
    padding: 2.5rem 0;
    margin-top: 3rem;
    border-radius: 10px 10px 0 0;
}

.main-footer p {
    margin-bottom: 1rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.social-links a {
    color: white;
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.social-links a:hover {
    transform: translateY(-5px) scale(1.1);
}

/* Back to Top Button */
.back-to-top {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top:hover {
    background-color: var(--secondary-color);
    transform: translateY(-3px);
}

/* Responsive Design */
@media (max-width: 992px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        position: static;
        flex: 0 0 auto;
        order: -1;
        margin-bottom: 30px;
    }
    
    .layout-comparison, .keyframe-explanation {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    .main-nav li {
        margin: 0.3rem 0;
    }
    
    .main-header h1 {
        font-size: 2.2rem;
    }
    
    .box-model-explanation {
        grid-template-columns: 1fr;
    }
}