/* EIRI Admin Panel */

:root {
  --bg-0:     #04080f;
  --bg-1:     #080e1a;
  --bg-2:     #0d1625;
  --bg-card:  #0f1e38;
  --bg-input: #08111e;

  --blue:     #1565C0;
  --blue-lit: #2196F3;
  --blue-dim: rgba(33,150,243,0.18);
  --border:   rgba(33,150,243,0.15);
  --border-md:rgba(33,150,243,0.30);

  --text:     #dce8f8;
  --text-dim: #6a84a0;
  --red:      #ef4444;
  --red-dim:  rgba(239,68,68,0.15);
  --green:    #22c55e;

  --f-tech: 'Orbitron', monospace;
  --f-body: 'Inter', sans-serif;
  --sidebar-w: 220px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--f-body); background: var(--bg-0); color: var(--text); overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
input, textarea, select { font-family: var(--f-body); font-size: 0.9rem; }

.adm-layout { display: flex; min-height: 100vh; } /* Sidebar */
.adm-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.adm-brand {
  padding: 1.5rem 1.2rem;
  border-bottom: 1px solid var(--border);
}
.adm-eiri {
  display: block;
  font-family: var(--f-tech);
  font-size: 0.95rem;
  font-weight: 900;
  color: #42A5F5;
  letter-spacing: 0.25em;
}
.adm-user {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.adm-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: all 0.18s;
  cursor: pointer;
}
.adm-nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.adm-nav-item:hover { background: var(--bg-card); color: var(--text); }
.adm-nav-item.active { background: var(--blue-dim); color: #90CAF9; }

.adm-sidebar-foot {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.adm-logout:hover { background: var(--red-dim); color: #fca5a5; }

.adm-main { margin-left: var(--sidebar-w); flex: 1; padding: 2rem 2.5rem; min-height: 100vh; background: var(--bg-0); } .adm-view { display: none; } .adm-view.active { display: block; } .adm-view-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 2rem; gap: 1rem; } .adm-view-header h2 { font-family: var(--f-tech); font-size: 1.4rem; font-weight: 700; color: #fff; } .adm-sub { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.25rem; } /* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.2rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-primary:hover { background: var(--blue-lit); box-shadow: 0 4px 20px rgba(33,150,243,0.4); }
.btn-primary svg { width: 15px; height: 15px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.2rem;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-md);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text); }
.btn-ghost svg { width: 15px; height: 15px; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.2rem;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-danger:hover { background: #dc2626; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  transition: all 0.18s;
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--bg-card); color: var(--text); }
.btn-icon.btn-del:hover { background: var(--red-dim); color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.btn-icon svg { width: 14px; height: 14px; }

.tutor-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.12rem 0.5rem;
  border-radius: 100px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #90CAF9;
  background: var(--blue-dim);
  border: 1px solid rgba(33,150,243,0.3);
  vertical-align: middle;
}

/* Sessions list */
.sessions-list { display: flex; flex-direction: column; gap: 1rem; }
.session-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; transition: border-color 0.2s, opacity 0.18s; }
.session-item:hover { border-color: var(--border-md); }
.session-item-head { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.2rem; cursor: pointer; user-select: none; }
.session-item-head:hover { background: rgba(33,150,243,0.04); }
.si-num { font-family: var(--f-tech); font-size: 0.68rem; color: var(--text-dim); letter-spacing: 0.15em; flex-shrink: 0; }
.si-title { flex: 1; font-size: 0.9rem; font-weight: 600; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-date { font-size: 0.75rem; color: var(--text-dim); white-space: nowrap; }

/* Status — clickable badge */
.si-status-btn { padding: 0.22rem 0.65rem; border-radius: 100px; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; flex-shrink: 0; cursor: pointer; background: none; border: none; transition: transform 0.12s, opacity 0.12s; }
.si-status-btn:hover { transform: scale(1.06); opacity: 0.85; }
.si-status-btn:disabled { cursor: wait; opacity: 0.5; }
.status-upcoming  { background: rgba(33,150,243,0.12); color: #42A5F5; border: 1px solid rgba(33,150,243,0.25) !important; }
.status-active    { background: rgba(34,197,94,0.12);  color: #22c55e; border: 1px solid rgba(34,197,94,0.25) !important; }
.status-completed { background: rgba(99,102,241,0.12); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.25) !important; }

.si-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.si-chevron { color: var(--text-dim); transition: transform 0.25s; flex-shrink: 0; }
.si-chevron svg { width: 16px; height: 16px; }
.session-item.open .si-chevron { transform: rotate(180deg); }
.session-item-body { display: none; padding: 0 1.2rem 1.2rem; border-top: 1px solid var(--border); }
.session-item.open .session-item-body { display: block; }

/* Drag handle */
.drag-handle { color: var(--text-dim); opacity: 0.35; cursor: grab; flex-shrink: 0; display: flex; align-items: center; transition: opacity 0.15s; }
.drag-handle:hover { opacity: 0.8; }
.drag-handle svg { width: 14px; height: 14px; }
.session-item.dragging, .project-item.dragging { opacity: 0.45; }
.session-item.drag-over  { border-color: var(--blue-lit); box-shadow: 0 0 0 2px rgba(33,150,243,0.25); }
.project-item.drag-over  { border-color: var(--blue-lit); box-shadow: 0 0 0 1px rgba(33,150,243,0.2); }

/* Projects list inside session */
.projects-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }

.project-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.project-item-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
}
.project-item-head:hover { background: rgba(33,150,243,0.04); border-radius: 10px; }
.pi-title { flex: 1; font-size: 0.84rem; font-weight: 600; color: var(--text); }
.pi-desc  { font-size: 0.74rem; color: var(--text-dim); }
.pi-chevron svg { width: 14px; height: 14px; }
.project-item.open .pi-chevron { transform: rotate(180deg); }

.project-item-body {
  display: none;
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}
.project-item.open .project-item-body { display: block; }

/* Assets list */
.assets-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; }

.asset-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.8rem;
}
.asset-item-type {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--blue-dim);
  border-radius: 6px;
  color: #42A5F5;
  flex-shrink: 0;
}
.asset-item-type svg { width: 13px; height: 13px; }
.asset-item-label { flex: 1; font-weight: 500; color: var(--text); }
.asset-item-lang  { font-size: 0.68rem; color: var(--text-dim); background: var(--bg-input); padding: 0.18rem 0.5rem; border-radius: 4px; }
.asset-item-lock  { color: #f59e0b; }
.asset-item-lock svg { width: 13px; height: 13px; }

/* Add buttons inside lists */
.add-row {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.field-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; } .field-group label { font-size: 0.78rem; color: var(--text-dim); font-weight: 500; } .field-group input, .field-group textarea, .field-group select { width: 100%; background: var(--bg-input); border: 1px solid var(--border-md); border-radius: 8px; padding: 0.6rem 0.85rem; color: var(--text); outline: none; transition: border-color 0.18s; resize: vertical; } .field-group input:focus, .field-group textarea:focus, .field-group select:focus { border-color: var(--blue-lit); } .field-group select option { background: var(--bg-1); } .field-group textarea.code-ta { font-family: 'Courier New', monospace; font-size: 0.8rem; line-height: 1.5; min-height: 220px; } .checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.82rem; color: var(--text-dim); } .checkbox-label input { width: auto; } /* Config */
.config-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
/* Contenido general and Contraseña span full width */
.config-sections > .config-card:first-child,
.config-sections > .config-card:last-child { grid-column: 1 / -1; }
.config-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
}
.config-card-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.config-card-head svg { width: 16px; height: 16px; color: var(--blue-lit); flex-shrink: 0; }
.config-card-head h3 { font-size: 0.9rem; font-weight: 700; color: #fff; margin: 0; }
.config-card-foot {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.config-two-col { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
.cfg-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.cfg-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }
.cfg-feedback { font-size: 0.78rem; min-height: 1.2rem; }
.cfg-feedback.ok  { color: var(--green); }
.cfg-feedback.err { color: var(--red); }

/* Hero live preview */
.cfg-hero-preview {
  background: linear-gradient(135deg, #011522 0%, #01305a 100%);
  border: 1px solid rgba(33,150,243,0.2);
  border-radius: 12px;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 200px;
  position: sticky;
  top: 1rem;
}
.chp-label {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(33,150,243,0.6);
  margin-bottom: 0.25rem;
}
.chp-title { font-family: var(--f-tech); font-size: 1.1rem; font-weight: 900; color: #fff; line-height: 1.2; }
.chp-subtitle { font-family: var(--f-tech); font-size: 0.62rem; letter-spacing: 0.25em; color: #42A5F5; }
.chp-desc { font-size: 0.75rem; color: rgba(220,232,248,0.55); line-height: 1.6; margin-top: 0.25rem; }
.chp-stats { display: flex; gap: 0.75rem; margin-top: 0.5rem; }
.chp-stat {
  background: rgba(33,150,243,0.1);
  border: 1px solid rgba(33,150,243,0.2);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  min-width: 54px;
}
.chp-stat span { font-family: var(--f-tech); font-size: 0.9rem; font-weight: 700; color: #42A5F5; }
.chp-stat small { font-size: 0.55rem; color: rgba(220,232,248,0.4); text-transform: uppercase; letter-spacing: 0.1em; }

.logs-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; } .logs-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; } .logs-table th { text-align: left; padding: 0.75rem 1rem; background: var(--bg-1); color: var(--text-dim); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; border-bottom: 1px solid var(--border); white-space: nowrap; } .logs-table td { padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); color: var(--text-dim); font-family: monospace; white-space: nowrap; } .logs-table tr:last-child td { border-bottom: none; } .logs-table td:nth-child(1) { font-size: 0.72rem; } .logs-table td:nth-child(2) { color: var(--text); font-weight: 500; }
.log-anon { color: var(--text-dim); font-style: italic; opacity: 0.65; }
/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--bg-1);
  border: 1px solid var(--border-md);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal--sm { max-width: 380px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-head h3 { font-size: 0.95rem; font-weight: 700; color: #fff; }
.modal-x { background: none; border: none; color: var(--text-dim); padding: 0.2rem; }
.modal-x:hover { color: var(--text); }
.modal-x svg { width: 18px; height: 18px; }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}
.modal-foot {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-0); padding: 2rem; } .login-wrap { width: 100%; max-width: 380px; } .login-card { background: var(--bg-1); border: 1px solid var(--border); border-radius: 20px; padding: 2.5rem 2rem; text-align: center; } .login-logos { display: flex; justify-content: center; margin-bottom: 1.5rem; } .login-logo-udd { height: 40px; object-fit: contain; } .login-brand { margin-bottom: 2rem; } .login-eiri { display: block; font-family: var(--f-tech); font-size: 1.5rem; font-weight: 900; color: #42A5F5; letter-spacing: 0.3em; margin-bottom: 0.3rem; } .login-panel-label { font-size: 0.78rem; color: var(--text-dim); letter-spacing: 0.08em; } .login-form { text-align: left; } .login-error { font-size: 0.8rem; color: var(--red); margin-bottom: 0.75rem; min-height: 1rem; } .login-error.ok { color: #34d399; } .login-link-btn { display: block; width: 100%; margin-top: 0.75rem; padding: 0; background: none; border: none; font-size: 0.8rem; color: var(--text-dim); text-align: center; cursor: pointer; transition: color 0.2s; } .login-link-btn:hover { color: var(--blue-lit); } .login-btn { width: 100%; padding: 0.75rem; background: var(--blue); color: #fff; border: none; border-radius: 10px; font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: background 0.2s; margin-top: 0.25rem; } .login-btn:hover:not(:disabled) { background: var(--blue-lit); } .login-btn:disabled { opacity: 0.5; cursor: not-allowed; } .login-back { display: block; margin-top: 1.5rem; font-size: 0.78rem; color: var(--text-dim); text-align: center; transition: color 0.2s; } .login-back:hover { color: var(--text); } /* Spin icon */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; display: inline-block; }

/* Botón hamburguesa y backdrop del cajón (ocultos en escritorio) */
.menu-toggle { display: none; }
.adm-sidebar-backdrop { display: none; }
.menu-toggle svg { width: 20px; height: 20px; display: block; }

/* Responsive */
@media (max-width: 900px) {
  .config-sections { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* Sidebar como cajón deslizable */
  .adm-sidebar {
    width: 250px;
    max-width: 82vw;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 1000;
  }
  .adm-sidebar.open { transform: translateX(0); }

  /* Backdrop oscuro cuando el cajón está abierto */
  .adm-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }
  .adm-sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Botón hamburguesa fijo */
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0.85rem;
    left: 0.85rem;
    z-index: 1001;
    background: var(--bg-card);
    border: 1px solid var(--border-md);
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--text);
  }

  .adm-main {
    margin-left: 0;
    padding: 4rem 1rem 2rem;
  }

  .adm-view-header {
    flex-direction: column;
    align-items: stretch;
  }
  .adm-view-header .btn-primary,
  .adm-view-header .btn-ghost { align-self: flex-start; }

  /* Encabezado de sesión: que no se desborde en pantallas chicas */
  .session-item-head { flex-wrap: wrap; }
  .si-title { flex-basis: 100%; order: -1; }
  .si-num { order: -2; }

  /* Tablas con scroll horizontal */
  .logs-table { min-width: 540px; }
  #galleryList, #rankingsList, #teamsList, #tutoresList { overflow-x: auto; }
}

@media (max-width: 420px) {
  html { font-size: 14px; }
  .adm-main { padding: 3.75rem 0.75rem 1.5rem; }
  .si-date { display: none; }
}

.assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.asset-image-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.asset-image-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.asset-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.asset-image-overlay .asset-item-label {
    font-size: 0.75rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Feedback / comentarios */
.feedback-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.8rem;
}
.feedback-card-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.5rem;
}
.feedback-card-name { font-weight: 600; color: var(--text); font-size: 0.85rem; }
.feedback-card-date { font-size: 0.72rem; color: var(--text-dim); margin-left: auto; }
.feedback-card-msg {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Preview panel (floating) ── */
.preview-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(540px, 94vw);
  height: min(680px, 88vh);
  min-width: 320px;
  min-height: 380px;
  z-index: 2000;
  background: var(--bg-0);
  display: none;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.04);
  resize: both;
}
.preview-overlay.open { display: flex; }
.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 1rem;
  cursor: move;
  user-select: none;
}
.preview-bar-title { font-family: var(--f-tech); font-size: 0.65rem; letter-spacing: 0.2em; color: var(--text-dim); text-transform: uppercase; }
.preview-bar-actions { display: flex; align-items: center; gap: 0.5rem; }
.preview-open-tab { font-size: 0.75rem; display: inline-flex; align-items: center; gap: 0.35rem; }
.preview-open-tab svg { width: 12px; height: 12px; }
.preview-frame { flex: 1; border: none; background: #fff; }

/* ── Responsive config ── */
@media (max-width: 900px) {
  .config-two-col { grid-template-columns: 1fr; }
  .cfg-hero-preview { position: static; }
  .cfg-row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 580px) {
  .cfg-row-2 { grid-template-columns: 1fr; }
  .cfg-row-3 { grid-template-columns: 1fr; }
}
