/* styles.css - Panel docente de resultados */
/* Basado en la identidad visual del hub general de Ayudante Actividades */

:root {
  --white: #ffffff;
  --gray-light: #f4f2f5;
  --gray: #b2acac;
  --gray-mid: #949494;
  --gray-dark: #827d7d;
  --black: #000000;
  --violet: #988db3;
  --teal: #00a99d;

  --red: #d93025;
  --yellow: #f9ab00;
  --green: #188038;

  --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.08);
  --shadow-strong: 0 12px 24px rgba(0, 0, 0, 0.12);
  --radius-card: 16px;
  --radius-hero: 18px;
  --radius-button: 10px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--gray-light);
  color: var(--black);
  line-height: 1.5;
}

/* ESTRUCTURA GENERAL */

.app-shell {
  min-height: 100vh;
}

main {
  max-width: 1200px;
  margin: auto;
  padding: 40px 20px;
}

/* HEADER - igual al hub general */

.logo-link {
  display: inline-block;
}

.site-header {
  background: var(--white);
  border-bottom: 4px solid var(--teal);
  padding: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition:
    padding 0.25s ease,
    border-bottom-width 0.25s ease,
    box-shadow 0.25s ease;
}

.header-container {
  max-width: 1200px;
  margin: auto;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "logo title"
    "nav nav";
  align-items: center;
  gap: 16px 24px;
}

.main-logo {
  grid-area: logo;
  height: 70px;
  width: auto;
  transition: height 0.25s ease;
}

.title-block {
  grid-area: title;
}

.title-block h1 {
  font-size: 2rem;
  letter-spacing: 1px;
  transition: font-size 0.25s ease;
}

.title-block p {
  color: var(--gray-dark);
  font-size: 1rem;
}

.main-nav {
  grid-area: nav;
  background: var(--black);
  display: flex;
  gap: 20px;
  padding: 14px 20px;
  flex-wrap: wrap;
  margin: 0 -20px -20px;
  transition:
    background 0.25s ease,
    padding 0.25s ease,
    margin 0.25s ease;
}

.main-nav a,
.nav-button {
  color: var(--white);
  text-decoration: none;
  font-weight: bold;
  transition: 0.2s;
}

.main-nav a:hover,
.nav-button:hover {
  color: var(--teal);
}

.nav-button {
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
}

/* HEADER COMPACTO AL HACER SCROLL */

.site-header.compact {
  padding: 8px 20px;
  border-bottom-width: 3px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.site-header.compact .header-container {
  grid-template-columns: auto 1fr;
  grid-template-areas: "logo nav";
}

.site-header.compact .main-logo {
  height: 42px;
}

.site-header.compact .title-block {
  display: none;
}

.site-header.compact .main-nav {
  margin: 0;
  padding: 0;
  background: transparent;
  justify-content: flex-end;
  align-items: center;
  transition: none;
}

.site-header.compact .main-nav a,
.site-header.compact .nav-button {
  color: var(--black);
  opacity: 1;
}

.site-header.compact .main-nav a:hover,
.site-header.compact .nav-button:hover {
  color: var(--teal);
}

/* BARRA DE USUARIO DOCENTE */

.teacher-bar {
  background: var(--black);
  color: var(--white);
  border-bottom: 4px solid var(--teal);
}

.teacher-bar-inner {
  max-width: 1200px;
  margin: auto;
  padding: 10px 20px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.teacher-bar span {
  color: var(--gray);
}

.teacher-bar strong {
  color: var(--white);
}

/* HERO LOGIN */

.login-view {
  display: block;
}

.hero {
  background: linear-gradient(135deg, var(--violet), var(--teal));
  color: var(--white);
  padding: 40px;
  border-radius: var(--radius-hero);
  margin-bottom: 40px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.hero h2 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.hero p {
  max-width: 760px;
  font-size: 1.1rem;
}

.login-card {
  min-height: 310px;
}

.login-note {
  display: inline-block;
  margin-top: 24px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
  font-weight: bold;
}

.google-login-container {
  margin-top: 28px;
  padding: 20px;
  background: var(--white);
  border-radius: 16px;
  width: fit-content;
  min-width: 280px;
}

.message {
  margin-top: 16px;
  font-weight: bold;
}

.message.error {
  color: #ffe5e5;
}

.message.success {
  color: #e7f6ec;
}

/* TÍTULOS */

.section-title {
  margin-bottom: 20px;
  font-size: 1.5rem;
  border-left: 6px solid var(--teal);
  padding-left: 12px;
}

/* CARDS */

.card {
  background: var(--white);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  border-top: 5px solid var(--violet);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-strong);
}

.card h3 {
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.card p {
  color: var(--gray-dark);
  margin-bottom: 18px;
}

.card-pi {
  border-top-color: var(--teal);
  background: linear-gradient(180deg, #ffffff 0%, rgba(0, 169, 157, 0.08) 100%);
}

.card-pii {
  border-top-color: var(--violet);
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    rgba(152, 141, 179, 0.14) 100%
  );
}

.card-bdi {
  border-top-color: var(--gray-dark);
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    rgba(130, 125, 125, 0.12) 100%
  );
}

/* BOTONES */

button {
  font: inherit;
}

.btn,
.detail-button,
.icon-button {
  border: 0;
  cursor: pointer;
  font-weight: bold;
  transition: 0.2s;
}

.btn,
.detail-button {
  display: inline-block;
  padding: 10px 16px;
  border-radius: var(--radius-button);
  text-decoration: none;
  background: var(--teal);
  color: var(--white);
}

.btn:hover,
.detail-button:hover {
  background: var(--black);
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--black);
  color: var(--white);
  font-size: 1.6rem;
  line-height: 1;
}

.icon-button:hover {
  background: var(--teal);
}

/* DASHBOARD */

.dashboard-view {
  display: grid;
  gap: 32px;
}

.filters-header,
.table-header,
.analysis-header,
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.filters-header p,
.table-header p,
.analysis-header p,
.modal-header p {
  color: var(--gray-dark);
  margin-top: 6px;
}

/* FILTROS */

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--gray-dark);
  font-weight: bold;
}

select,
input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--gray);
  border-radius: 10px;
  background: var(--white);
  color: var(--black);
  font: inherit;
}

select:focus,
input:focus {
  outline: 3px solid rgba(0, 169, 157, 0.22);
  border-color: var(--teal);
}

/* RESUMEN */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 24px;
}

.summary-card {
  min-height: 120px;
}

.summary-label {
  display: block;
  color: var(--gray-dark);
  margin-bottom: 8px;
  font-weight: bold;
}

.summary-card strong {
  font-size: 2rem;
}

.summary-green {
  border-top-color: var(--green);
  background: linear-gradient(180deg, #ffffff 0%, rgba(24, 128, 56, 0.1) 100%);
}

.summary-yellow {
  border-top-color: var(--yellow);
  background: linear-gradient(180deg, #ffffff 0%, rgba(249, 171, 0, 0.14) 100%);
}

.summary-red {
  border-top-color: var(--red);
  background: linear-gradient(180deg, #ffffff 0%, rgba(217, 48, 37, 0.1) 100%);
}

/* TABLA */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  background: var(--white);
}

thead {
  background: var(--black);
  color: var(--white);
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  text-align: left;
  vertical-align: middle;
  font-size: 0.95rem;
}

tbody tr {
  transition: 0.2s;
}

tbody tr:hover {
  background: rgba(0, 169, 157, 0.06);
}

.sort-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--white);
  font: inherit;
  font-weight: bold;
  cursor: pointer;
}

.sort-button:hover {
  color: var(--teal);
}

.empty-cell,
.empty-state {
  color: var(--gray-dark);
  text-align: center;
  padding: 20px;
}

/* SEMÁFORO */

.score-pill {
  display: inline-block;
  min-width: 64px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: bold;
}

.score-red {
  background: #ffe5e5;
  color: #9f1b1b;
}

.score-yellow {
  background: #fff4d6;
  color: #8a5a00;
}

.score-green {
  background: #e7f6ec;
  color: #087443;
}

.score-strong-green {
  background: #d8f3dc;
  color: #065f46;
}

.row-red {
  border-left: 5px solid var(--red);
}

.row-yellow {
  border-left: 5px solid var(--yellow);
}

.row-green {
  border-left: 5px solid var(--green);
}

.row-strong-green {
  border-left: 5px solid var(--green);
}

/* ANÁLISIS POR PREGUNTA */

.question-analysis-container {
  display: grid;
  gap: 14px;
}

.question-row {
  display: grid;
  grid-template-columns: 120px 1fr 90px;
  align-items: center;
  gap: 14px;
  background: var(--white);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-soft);
  border-top: 5px solid var(--violet);
}

.question-title {
  font-weight: bold;
}

.question-bar {
  height: 14px;
  border-radius: 99px;
  background: var(--gray-light);
  overflow: hidden;
}

.question-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--teal);
}

.question-percent {
  text-align: right;
  font-weight: bold;
}

/* MODAL */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
}

.modal-card {
  width: min(980px, 100%);
  max-height: 92vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--white);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  border-top: 5px solid var(--teal);
}

.modal-header {
  padding: 24px;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.modal-content {
  overflow: auto;
  padding: 24px;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.detail-summary-item {
  background: var(--gray-light);
  border-radius: 16px;
  padding: 16px;
  border-top: 5px solid var(--violet);
}

.detail-summary-item span {
  display: block;
  color: var(--gray-dark);
  font-weight: bold;
  margin-bottom: 6px;
}

.answer-list {
  display: grid;
  gap: 14px;
}

.answer-card {
  background: var(--white);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-soft);
  border-top: 5px solid var(--violet);
}

.answer-card.correct {
  border-top-color: var(--green);
}

.answer-card.incorrect {
  border-top-color: var(--red);
}

.answer-card h3 {
  margin-bottom: 8px;
}

.answer-card p {
  color: var(--gray-dark);
  margin-top: 6px;
}

.answer-card strong {
  color: var(--black);
}

/* FOOTER */

footer {
  background: var(--black);
  color: var(--white);
  text-align: center;
  padding: 30px 20px;
  margin-top: 50px;
}

footer small {
  color: #cccccc;
}

/* UTILIDADES */

[hidden] {
  display: none !important;
}

/* RESPONSIVE */

@media (max-width: 900px) {
  .filters-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .site-header {
    padding: 16px;
  }

  .header-container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "logo"
      "title"
      "nav";
    align-items: flex-start;
  }

  .main-logo {
    height: 56px;
  }

  .title-block h1 {
    font-size: 1.6rem;
  }

  .main-nav {
    flex-direction: column;
    gap: 12px;
    width: calc(100% + 32px);
    margin: 0 -16px -16px;
    padding: 14px 16px;
  }

  .site-header.compact {
    padding: 10px 16px;
  }

  .site-header.compact .header-container {
    grid-template-columns: auto 1fr;
    grid-template-areas: "logo nav";
    align-items: center;
  }

  .site-header.compact .main-logo {
    height: 38px;
  }

  .site-header.compact .main-nav {
    flex-direction: row;
    justify-content: flex-end;
    gap: 10px;
    width: auto;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
  }

  main {
    padding: 28px 16px;
  }

  .hero {
    padding: 28px;
  }

  .hero h2 {
    font-size: 1.6rem;
  }

  .filters-header,
  .table-header,
  .analysis-header,
  .modal-header {
    flex-direction: column;
  }

  .filters-grid,
  .summary-grid,
  .detail-summary,
  .question-row {
    grid-template-columns: 1fr;
  }

  .question-percent {
    text-align: left;
  }

  .google-login-container {
    width: 100%;
  }
}
