@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
  --primary: #4A6FA5;
  --secondary: #166088;
  --accent: #4FC3F7;
  --dark: #1A2639;
  --light: #F0F4F8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  display: flex;
  min-height: 100vh;
  background-color: var(--light);
}

aside {
  width: 280px;
  background-color: white;
  padding: 20px;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.user-profile {
  text-align: center;
  margin-bottom: 30px;
}

.user-profile img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 10px;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

nav a {
  padding: 12px 15px;
  text-decoration: none;
  color: var(--dark);
  border-radius: 8px;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 10px;
}

nav a:hover,
nav a.active {
  background-color: var(--light);
  color: var(--primary);
}

nav a button {
  background-color: #FFD166;
  color: var(--dark);
  border: none;
  border-radius: 8px;
  padding: 10px;
  width: 100%;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
}

nav a button:hover {
  background-color: #ceba7e;
}

main {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

#search-bar {
  padding: 10px 15px;
  border-radius: 25px;
  border: 1px solid #ddd;
  width: 300px;
}

.categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.category-card {
  background-color: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.3s;
  cursor: pointer;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.category-card h3 {
  color: var(--primary);
  margin-bottom: 10px;
}

/* Modales */
.flashcard-modal,
.difficulty-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1050; 
}

.flashcard-modal.active,
.difficulty-modal.active {
  display: flex;
}

.flashcard-content,
.difficulty-content {
  background-color: rgb(255, 255, 255);
  width: 90%;
  max-width: 800px;
  border-radius: 15px;
  padding: 30px;
  position: relative;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 1051; 
}
.close-modal {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
}

/* Elementos de flashcard */
.flashcard-question {
  font-size: 24px;
  text-align: center;
  margin: 30px 0;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flashcard-answer {
  display: none;
  font-size: 20px;
  color: var(--secondary);
  text-align: center;
  margin: 30px 0;
  min-height: 100px;
  align-items: center;
  justify-content: center;
}

.controls {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
}

.controls button {
  padding: 12px 25px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
}

.show-answer-btn {
  background-color: var(--primary);
  color: white;
}

.next-btn {
  background-color: var(--accent);
  color: white;
}

.difficulty-btn {
  padding: 10px 20px;
  border-radius: 20px;
  border: none;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.3s;
}

.difficulty-btn:hover {
  transform: scale(1.05);
}

.easy { background-color: #43A047; }
.medium { background-color: #FB8C00; }
.hard { background-color: #E53935; }
.dont-know { background-color: #757575; }

.progress-container {
  margin-top: 30px;
}

.progress-bar {
  height: 8px;
  background-color: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.progress {
  height: 100%;
  background-color: var(--primary);
  width: 0%;
  transition: width 0.3s;
}

/* ✅ Agrupación visual de flashcards por nivel */
.flashcard-list {
  display: flex;
  flex-direction: column;
  gap: 35px;
  margin-top: 20px;
}

.level-label {
  font-size: 20px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 10px;
}

.flashcard-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.flashcard-box {
  background-color: white;
  border: 1px solid #ddd;
  border-left: 6px solid;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 5px 12px rgba(0,0,0,0.05);
  transition: transform 0.25s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flashcard-box:hover {
  transform: translateY(-6px);
}

.flashcard-box p {
  margin: 0;
  line-height: 1.4;
  color: #444;
  font-size: 15px;
}

.easy-group .flashcard-box { border-left-color: #43A047; }
.medium-group .flashcard-box { border-left-color: #FB8C00; }
.hard-group .flashcard-box { border-left-color: #E53935; }

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }

  aside {
    width: 100%;
  }

  .topbar {
    flex-direction: column;
    gap: 15px;
  }

  .search-bar {
    display: none !important;
    width: 100%;
  }
 

  .difficulty-buttons {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
}

#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1100; 
  pointer-events: none;
}

.Motivacion-toast {
  background-color: #ffffff;
  border-left: 5px solid #4caf50;
  color: #333;
  padding: 1rem 1.5rem;
  border-radius: 10px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
  font-size: 0.95rem;
  max-width: 320px;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.4s ease-in-out;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}
.Motivacion-toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: #4caf50;
  animation: progressBar 5s linear forwards;
}

@keyframes progressBar {
  from { width: 100%; }
  to { width: 0%; }
}

.Motivacion-toast.activo {
  opacity: 1;
  transform: translateX(0);
}

.Motivacion-toast.activo.saliendo {
  opacity: 0;
  transform: translateY(-20px);
  margin-top: -50px;
}

/* Contenedor de botones: estilo horizontal y centrado */
.controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* Contenedor de botones */
.controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* Estilo base para todos los botones */
.controls button {
  font-weight: 600;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  min-width: 160px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

/* Mostrar respuesta: azul oscuro */
.show-answer-btn {
  background-color: #4A6FA5;
  color: white;
}

.show-answer-btn:hover {
  background-color: #4A6FA5;
}

/* Siguiente: azul claro */
.next-btn {
  background-color: #6190d7;
  color: white;
}

.next-btn:hover {
  background-color: #2563eb;
}

/* Volver: gris claro con un toque violeta */
.back-btn {
  background-color: #bdc5d3;
  color: #9f21e3;
  border: 2px solid #e5e7eb;
}

.back-btn:hover {
  background-color: #e5e7eb;
}


/*Nueva actualizacion*/
/* Botón contador de flashcards */
.card-counter {
  position: absolute;
  top: 2vh;
  right: 9vw; /* ← aumentado para evitar que tape la X */
  background-color: #2563eb;
  color: #ffffff;
  padding: 0.4em 0.9em;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.25);
  z-index: 9; /* Asegura que no esté encima de la X si tienen mismo contenedor */
  transition: all 0.3s ease;
}

/* Tamaño de pantalla pequeño (teléfonos) */
@media screen and (max-width: 480px) {
  .card-counter {
    top: 1.5vh;
    right: 10vw;  /* Más separación en móvil */
    font-size: 0.8rem;
    padding: 0.3em 0.7em;
  }
}

@media screen and (max-width: 768px) {
  .card-counter {
    top: 1.8vh;
    right: 9vw;
    font-size: 0.85rem;
    padding: 0.35em 0.8em;
  }
}
#flashcardContainer {
  transition: filter 0.3s ease;
}

/*NUEVO*/
/* Reiniciar flashcards */
#restartBtn {
  display: none;
}

/* Flashcard activa */
.flashcard {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.flashcard.activa {
  opacity: 1;
  transform: translateY(0);
}
.controls button {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease-in-out;
}
.controls button:hover {
  transform: scale(1.05);
}

#progressBar {
  height: 8px;
  border-radius: 10px;
  background: linear-gradient(to right, #3b82f6, #9333ea);
  transition: width 0.3s ease;
}
.icono-categoria {
  font-size: 20px;
  margin-right: 8px;
}

/*nueva para el temporizador*/
#timer.agotado {
  animation: parpadeoAlerta 0.8s infinite;
  color: #dc2626;
  font-weight: bold;
}

@keyframes parpadeoAlerta {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

/* nueva funcion  */
.agotado {
  animation: shake 0.4s ease-in-out infinite;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

