/* Reset y configuración base */
* {
  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: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  padding: 2rem 0;
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 2.5rem;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.header p {
  color: #7f8c8d;
  font-size: 1.2rem;
}

/* Main content */
.main {
  padding: 2rem 0;
}

/* Introducción */
.intro {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 3rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.intro h2 {
  color: #2c3e50;
  font-size: 2rem;
  margin-bottom: 1rem;
  text-align: center;
}

.intro p {
  color: #555;
  margin-bottom: 2rem;
  text-align: center;
  font-size: 1.1rem;
}

.flex-concepts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.concept {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 1.5rem;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.concept h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.concept p {
  margin-bottom: 1rem;
  opacity: 0.9;
}

.concept code {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
}

/* Ejercicios */
.exercise {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 3rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.exercise h2 {
  color: #2c3e50;
  font-size: 1.8rem;
  margin-bottom: 1rem;
  border-bottom: 3px solid #667eea;
  padding-bottom: 0.5rem;
}

.exercise p {
  color: #555;
  margin-bottom: 1.5rem;
}

.exercise ul {
  margin-left: 2rem;
  margin-bottom: 1.5rem;
}

.exercise li {
  margin-bottom: 0.5rem;
  color: #555;
}

/* Áreas de demostración */
.demo-area {
  border: 3px dashed #667eea;
  padding: 2rem;
  margin: 1.5rem 0;
  background: #f8f9fa;
  border-radius: 10px;
}

.demo-area h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

/* Contenedores flex */
.container-no-flex {
  border: 2px dashed #e74c3c;
  padding: 1rem;
  background: #fdf2f2;
  margin-bottom: 1rem;
}

.container-flex {
  display: flex;
  border: 2px dashed #667eea;
  padding: 1rem;
  background: #f8f9fa;
}

.flex-container {
  display: flex;
  border: 2px dashed #667eea;
  padding: 1rem;
  background: #f8f9fa;
  margin: 1rem 0;
  min-height: 80px;
}

/* Elementos flex */
.flex-item {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 1rem;
  margin: 5px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  min-width: 80px;
  min-height: 60px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.flex-item:hover {
  transform: scale(1.05);
}

.flex-item.tall {
  min-height: 100px;
}

.flex-item.wide {
  min-width: 200px;
}

/* Flex Direction */
.row {
  flex-direction: row; /* por defecto */
}

.column {
  flex-direction: column;
  min-height: 200px;
}

.row-reverse {
  flex-direction: row-reverse;
}

.column-reverse {
  flex-direction: column-reverse;
  min-height: 200px;
}

/* Justify Content */
.justify-start {
  justify-content: flex-start; /* por defecto */
}

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.justify-evenly {
  justify-content: space-evenly;
}

/* Align Items */
.align-stretch {
  align-items: stretch; /* por defecto */
}

.align-start {
  align-items: flex-start;
}

.align-center {
  align-items: center;
}

.align-end {
  align-items: flex-end;
}

.align-baseline {
  align-items: baseline;
}

/* Centrado perfecto */
.perfect-center {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 10px;
  margin: 1rem 0;
}

.centered-content {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  max-width: 400px;
}

.centered-content h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
}

.centered-content p {
  color: #555;
}

/* Flex Wrap */
.no-wrap {
  flex-wrap: nowrap; /* por defecto */
}

.wrap {
  flex-wrap: wrap;
}

.wrap-reverse {
  flex-wrap: wrap-reverse;
}

/* Navbar demo */
.navbar-demo {
  margin: 2rem 0;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.logo {
  font-weight: bold;
  font-size: 1.2rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  transition: background 0.3s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.2);
}

.action-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

.action-btn:hover {
  background: white;
  color: #667eea;
}

/* Ejemplos de código */
.code-example {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 1.5rem;
  border-radius: 10px;
  margin: 1.5rem 0;
}

.code-example h3 {
  color: #3498db;
  margin-bottom: 1rem;
}

.code-example pre {
  background: #34495e;
  padding: 1rem;
  border-radius: 5px;
  overflow-x: auto;
}

.code-example code {
  background: none;
  color: #ecf0f1;
  padding: 0;
}

/* Footer */
.footer {
  background: rgba(44, 62, 80, 0.95);
  color: white;
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
}

.btn-back {
  display: inline-block;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  text-decoration: none;
  padding: 0.8rem 1.5rem;
  border-radius: 25px;
  margin-top: 1rem;
  transition: all 0.3s ease;
}

.btn-back:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
  .header h1 {
    font-size: 2rem;
  }

  .exercise {
    padding: 1.5rem;
  }

  .demo-area {
    padding: 1rem;
  }

  .flex-item {
    min-width: 60px;
    min-height: 50px;
    font-size: 0.8rem;
    padding: 0.8rem;
  }

  .flex-item.wide {
    min-width: 150px;
  }

  .flex-concepts {
    grid-template-columns: 1fr;
  }

  .navbar {
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
  }

  .nav-links {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .perfect-center {
    min-height: 250px;
  }

  .centered-content {
    padding: 1.5rem;
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 10px;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .exercise h2 {
    font-size: 1.5rem;
  }

  .flex-item {
    min-width: 50px;
    min-height: 40px;
    font-size: 0.7rem;
    padding: 0.5rem;
    margin: 3px;
  }

  .flex-item.wide {
    min-width: 120px;
  }

  .flex-container {
    padding: 0.8rem;
  }

  .perfect-center {
    min-height: 200px;
  }

  .centered-content {
    padding: 1rem;
    max-width: 250px;
  }
}
