/* ==============================
   styles.css
   Completo con todas las secciones y últimas actualizaciones
   ============================== */

/* ===== Variables ===== */
:root {
  --sidebar-bg: #1e1f2f;
  --sidebar-color: #cfd0da;
  --sidebar-hover: #2a2d3e;
  --primary-color: #1e90ff;
  --primary-hover: #187bcd;
  --bg-light: #f5f6fa;
  --bg-white: #fff;
  --text-dark: #333;
  --border-light: #ddd;
  --shadow: rgba(0,0,0,0.1);
  --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --danger-color: #e74c3c;
}

/* Dark mode overrides */
body.dark {
  --sidebar-bg: #111;
  --sidebar-color: #ccc;
  --sidebar-hover: #222;
  --bg-light: #1e1e1e;
  --bg-white: #2e2e2e;
  --text-dark: #eee;
  --border-light: #444;
  --shadow: rgba(0,0,0,0.5);
}

/* ===== Global resets ===== */
*, *::before, *::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: var(--font-family);
  background: var(--bg-light);
  color: var(--text-dark);
}
a {
  text-decoration: none;
  color: inherit;
}
.hidden {
  display: none !important;
}

/* ===== Login screen ===== */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
}
.login-box {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow);
  width: 320px;
}
.login-box h2 {
  text-align: center;
  margin-bottom: 1rem;
}
.login-box input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: var(--bg-light);
  color: var(--text-dark);
}
.login-box button {
  width: 100%;
  padding: 0.75rem;
  background: var(--primary-color);
  border: none;
  border-radius: 4px;
  color: var(--bg-white);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.login-box button:hover {
  background: var(--primary-hover);
}
.error-msg {
  color: var(--danger-color);
  text-align: center;
  height: 1.25rem;
}

/* ===== Dashboard layout ===== */
.dashboard {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-color);
  padding-top: 2rem;
  transition: transform 0.3s ease;
}
.sidebar.closed {
  transform: translateX(-100%);
}
.sidebar .brand {
  text-align: center;
  font-size: 1.5rem;
  color: var(--bg-white);
  margin-bottom: 1rem;
}
.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links li {
  margin: 0.25rem 0;
}
.nav-links li a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--sidebar-color);
  transition: background 0.2s, color 0.2s;
}
.nav-links li.active a,
.nav-links li a:hover {
  background: var(--sidebar-hover);
  color: var(--bg-white);
}

/* ===== Submenus ===== */
#inst-nav,
#games-nav {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border-light);
}
.inst-links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.inst-links li {
  margin: 0.25rem 0;
}
.inst-links li a {
  display: block;
  padding: 0.5rem 1.25rem;
  color: var(--sidebar-color);
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}
.inst-links li.active a,
.inst-links li a:hover {
  background: var(--sidebar-hover);
  color: var(--bg-white);
}

/* ===== Content ===== */
.content {
  flex: 1;
  margin-left: 240px;
  padding: 1rem;
  overflow-y: auto;
  height: 100vh;
}

/* ===== Topbar ===== */
.topbar {
  position: fixed;
  top: 0;
  left: 240px;
  right: 0;
  height: 60px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  z-index: 100;
}
.hamburger-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  margin-right: 1rem;
}
.topbar h1 {
  flex: 1;
  text-align: center;
  margin: 0;
  font-size: 1.25rem;
}
.topbar-avatar {
  position: relative;
}
.topbar-avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--primary-color);
}
.profile-popup {
  position: absolute;
  top: 44px;
  right: 0;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  padding: 0.5rem;
  border-radius: 4px;
  box-shadow: 0 2px 6px var(--shadow);
  width: 200px;
}
.profile-popup.hidden {
  display: none;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.topbar-actions button {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  transition: background 0.2s;
}
.topbar-actions button:hover {
  background: rgba(0,0,0,0.05);
  border-radius: 4px;
}

/* ===== Section base ===== */
.section {
  padding-top: 80px;
  display: none;
}
.section.active {
  display: block;
}

/* ===== Home ===== */
#home p {
  font-size: 1.1rem;
}

/* ===== Profile ===== */
.profile-section {
  max-width: 500px;
  margin: 2rem auto;
  background: var(--bg-white);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 12px var(--shadow);
}
.profile-photo {
  text-align: center;
  margin-bottom: 1rem;
}
.profile-photo img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-color);
}
.profile-fields label {
  display: block;
  margin-top: 1rem;
  font-weight: bold;
}
.profile-fields input,
.profile-fields textarea {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
  border: 1px solid var(--border-light);
  border-radius: 4px;
}
#save-profile {
  margin-top: 1.5rem;
  width: 100%;
  padding: 0.75rem;
  background: var(--primary-color);
  color: var(--bg-white);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
#save-profile:hover {
  background: var(--primary-hover);
}
.success-msg {
  color: green;
  margin-top: 0.75rem;
  text-align: center;
}

/* ===== Settings ===== */
.settings-section {
  max-width: 600px;
  margin: 2rem auto;
  background: var(--bg-white);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 12px var(--shadow);
}
.settings-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}
#dark-mode-toggle {
  transform: scale(1.2);
  cursor: pointer;
}
#export-profile {
  padding: 0.5rem 1rem;
  background: var(--primary-color);
  color: var(--bg-white);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
#export-profile:hover {
  background: var(--primary-hover);
}

/* ===== Instituto ===== */
.inst-subsection {
  display: none;
  margin-top: 1rem;
}
.inst-subsection.active {
  display: block;
}
.inst-subsection h3 {
  margin-top: 0;
  color: var(--primary-color);
}

/* ===== Horario Instituto ===== */
.horario-container {
  overflow-x: auto;
  margin-top: 1rem;
  background: var(--bg-white);
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
}
.horario-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
.horario-table th,
.horario-table td {
  padding: 0.75rem;
  border: 1px solid var(--border-light);
  text-align: center;
  vertical-align: middle;
  font-size: 0.9rem;
}
.horario-table thead {
  background: var(--primary-color);
  color: var(--bg-white);
}
.horario-table tbody tr:nth-child(even) {
  background: rgba(0,0,0,0.02);
}
.horario-table td strong {
  display: block;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}
.horario-table td em {
  display: block;
  color: var(--text-dark);
  font-size: 0.85rem;
}

/* ===== Juegos ===== */
.games-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.games-controls input,
.games-controls select {
  padding: 0.5rem;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 1rem;
  flex: 1 1 200px;
}
.games-controls button {
  padding: 0.5rem 1rem;
  background: var(--primary-color);
  color: var(--bg-white);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.games-controls button:hover {
  background: var(--primary-hover);
}

.game-form {
  background: var(--bg-white);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
  margin-bottom: 1rem;
  display: grid;
  gap: 0.5rem;
  max-width: 400px;
}
.game-form input {
  padding: 0.5rem;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 1rem;
}
#save-game-btn {
  background: var(--primary-color);
  color: var(--bg-white);
}
#cancel-game-btn {
  background: #ccc;
  color: var(--text-dark);
}
.game-form.hidden {
  display: none !important;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.game-card {
  background: var(--bg-white);
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.game-card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
}
.game-card .card-body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.game-card .card-body h4 {
  margin: 0;
  font-size: 1rem;
}
.game-card .card-body p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-dark);
  flex: 1;
}
.game-card .card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border-top: 1px solid var(--border-light);
  gap: 0.5rem;
}
.game-card .card-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  transition: color 0.2s;
}
.game-card .card-actions button:hover {
  color: var(--primary-color);
}

/* ===== Edit/Delete buttons ===== */
.game-card .edit-btn,
.game-card .delete-btn {
  font-size: 1.2rem;
}
.game-card .edit-btn:hover {
  color: var(--primary-hover);
}
.game-card .delete-btn:hover {
  color: var(--danger-color);
}

/* ===== Ruleta ===== */
.roulette-container {
  text-align: center;
  margin-top: 1rem;
}
#roulette-wheel {
  border: 4px solid var(--primary-color);
  border-radius: 50%;
  display: block;
  margin: 0 auto 1rem;
  transition: transform 5s cubic-bezier(0.33,1,0.68,1);
}
#spin-wheel-btn {
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: var(--bg-white);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}
#spin-wheel-btn:hover {
  background: var(--primary-hover);
}
.roulette-result {
  margin-top: 1rem;
  font-size: 1.1rem;
  font-weight: bold;
}

/* ===== Cosas Personales ===== */
#cosas {
  max-width: 800px;
  margin: 2rem auto;
  background: var(--bg-white);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 12px var(--shadow);
}

/* ===== Scrum Board ===== */
.scrum-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.scrum-controls input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 1rem;
}
.scrum-controls button {
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: var(--bg-white);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.scrum-controls button:hover {
  background: var(--primary-hover);
}
.scrum-board {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.scrum-column {
  background: var(--bg-white);
  flex: 1;
  min-width: 200px;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 12px var(--shadow);
}
.scrum-column h3 {
  margin-top: 0;
}
.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.task-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0f0f0;
  margin-bottom: 0.5rem;
  padding: 0.75rem;
  border-radius: 4px;
}
.task-text {
  flex: 1;
}
.task-controls button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  margin-left: 0.5rem;
  transition: color 0.2s;
}
.task-controls button:hover {
  color: var(--primary-color);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .content {
    margin-left: 0;
    padding-top: 60px;
  }
  .topbar {
    left: 0;
  }
}
@media (max-width: 600px) {
  .scrum-board {
    flex-direction: column;
  }
}
