@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Sora:wght@600;700&display=swap");

:root {
  --bg: #f2f7ff;
  --bg-soft: #e8f0ff;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --text: #132037;
  --muted: #53627d;
  --line: #d4deee;
  --brand: #0b63f3;
  --brand-hover: #0452d0;
  --teal: #067f7a;
  --teal-hover: #056560;
  --danger: #cd1349;
  --danger-hover: #ab0f3d;
  --ok: #0f6d33;
  --focus: rgba(11, 99, 243, 0.24);
  --shadow-soft: 0 16px 30px rgba(20, 43, 90, 0.08);
  --shadow-topbar: 0 12px 26px rgba(9, 23, 53, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(1100px 600px at -15% -20%, #c8ddff 0%, transparent 55%),
    radial-gradient(900px 480px at 120% -10%, #d9e8ff 0%, transparent 58%),
    linear-gradient(175deg, var(--bg) 0%, var(--bg-soft) 100%);
  min-height: 100vh;
}

body.auth-page {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(120, 140, 255, 0.35) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(255, 130, 180, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(100, 220, 255, 0.2) 0%, transparent 60%),
    linear-gradient(135deg, #1a1f4e 0%, #2d3561 50%, #1f2940 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

body.auth-page .topbar {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.2rem;
  color: #fff;
  background: linear-gradient(130deg, #0f2347, #1c4f85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow-topbar);
  backdrop-filter: blur(8px);
}

.topbar h1 {
  margin: 0;
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topbar nav {
  display: flex;
  gap: 0.52rem;
  flex-wrap: wrap;
}

.topbar a {
  color: #fff;
  text-decoration: none;
  padding: 0.45rem 0.74rem;
  border-radius: 999px;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.09);
  transition: transform 0.18s ease, background 0.18s ease;
}

.topbar a:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.container {
  max-width: 1220px;
  margin: 1.3rem auto;
  padding: 0 1rem 2.5rem;
}

h2 {
  margin: 0 0 0.7rem;
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  letter-spacing: 0.01em;
}

h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  font-size: 1.02rem;
}

a {
  color: var(--brand);
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
}

.card {
  border: 1px solid rgba(183, 200, 226, 0.8);
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(6px);
  padding: 1rem;
}

.card.auth-card {
  max-width: 420px;
  margin: 0 auto;
  padding: 2.2rem 2rem 2rem;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.login-logo img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  padding: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

label {
  display: block;
  margin: 0.44rem 0;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

input,
select,
button {
  width: 100%;
  padding: 0.72rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.95rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

input:focus,
select:focus,
button:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

input:focus,
select:focus,
button:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus);
}

button {
  cursor: pointer;
  font-weight: 600;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 1rem;
  padding: 0.8rem;
  letter-spacing: 0.02em;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.45);
}

button:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.alert {
  margin-bottom: 1rem;
  padding: 0.76rem 0.86rem;
  border-radius: 12px;
  border: 1px solid #b8f3cd;
  color: var(--ok);
  background: #ebfff2;
}

.alert.error {
  border-color: #ffc3d1;
  color: #a4113b;
  background: #fff0f4;
}

body.auth-page .alert {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 200, 210, 0.5);
  color: #ffcfd8;
  backdrop-filter: blur(10px);
}

body.auth-page .alert.error {
  background: rgba(255, 80, 80, 0.2);
  border-color: rgba(255, 150, 150, 0.4);
  color: #ffb3b3;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-solid);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-solid);
}

.table-responsive table {
  min-width: 680px;
}

.table-wide table {
  min-width: 1300px;
}

th,
td {
  border: 1px solid #d9e3f3;
  padding: 0.56rem;
  text-align: left;
  vertical-align: middle;
  font-size: 0.92rem;
}

th {
  background: #edf3fd;
  color: #0f274b;
}

thead tr.head-1 th {
  background: #dfeaff;
  text-align: center;
}

.dim-head {
  text-align: center;
}

.dim-ser {
  background: #fff6e4 !important;
}

.dim-saber {
  background: #e9fff3 !important;
}

.dim-hacer {
  background: #ebf4ff !important;
}

.dim-autoevaluacion {
  background: #f7eeff !important;
}

tbody tr:nth-child(2n) {
  background: #f8fbff;
}

.muted {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.88rem;
  text-align: center;
  margin-top: 0.5rem;
}

.grade-red {
  color: #dc2626 !important;
}

.text-amber-600 {
  color: #d97706 !important;
}

.grade-green {
  color: #16a34a !important;
}

.grade-blue {
  color: #2563eb !important;
}

input.grade-red:disabled,
input.text-amber-600:disabled,
input.grade-green:disabled,
input.grade-blue:disabled {
  opacity: 1;
  -webkit-text-fill-color: currentColor;
}

.inline-form {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  flex-wrap: wrap;
}

.inline-form > div {
  min-width: 200px;
  flex: 1;
}

.input-small {
  width: 94px;
}

.center {
  text-align: center;
}

.actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.actions form {
  margin: 0;
}

.actions button {
  width: auto;
  padding: 0.46rem 0.7rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}




.header-action {
  margin-top: 0.25rem;
}

.header-action input {
  display: none;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    padding: 0.9rem 1rem;
  }

  .topbar nav {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
  }

  .topbar a {
    text-align: center;
  }

  .container {
    margin-top: 1rem;
  }

  .inline-form > div {
    min-width: 100%;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions .button-link,
  .actions button {
    width: 100%;
    text-align: center;
  }

  .input-small {
    width: 75px;
  }

  th,
  td {
    font-size: 0.84rem;
  }
}

.grades-table th,
.grades-table td {
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid #f1f5f9;
  padding: 0.6rem 0.55rem;
}

.grades-table thead th {
  border-bottom-color: #e2e8f0;
}

.grades-table .student-name {
  font-weight: 500;
  color: #334155;
}

.grades-table .activity-col {
  min-width: 56px;
  vertical-align: bottom;
}

.grades-table .activity-label {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  line-height: 1.1;
  font-weight: 600;
  font-size: 0.82rem;
}

.grades-table .total-auto-col {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
}

.grades-table .vertical-total-label {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.1;
}

.grades-table .total-compact-col {
  width: 62px;
  min-width: 62px;
  max-width: 62px;
  text-align: center;
}

.grades-table .compact-total-label {
  display: inline-block;
  max-width: 52px;
  white-space: normal;
  line-height: 1.1;
  font-size: 0.75rem;
  color: #64748b;
}

.grades-table .total-compact-cell {
  width: 62px;
  min-width: 62px;
  max-width: 62px;
  text-align: center;
  padding-left: 0.3rem;
  padding-right: 0.3rem;
}

.grades-table .input-small {
  width: 64px;
  padding: 0.45rem 0.35rem;
}

.grades-table .student-name {
  min-width: 170px;
}

.grades-table thead tr.head-1 th {
  background: rgba(248, 250, 252, 0.5);
}

.grades-table .dim-ser {
  background: rgba(248, 250, 252, 0.5) !important;
  color: #4f6ea8;
}

.grades-table .dim-saber {
  background: rgba(248, 250, 252, 0.5) !important;
  color: #5f5fa8;
}

.grades-table .dim-hacer {
  background: rgba(248, 250, 252, 0.5) !important;
  color: #3f8a6e;
}

.grades-table .dim-autoevaluacion {
  background: rgba(248, 250, 252, 0.5) !important;
  color: #64748b;
}

.grades-table .total-final {
  background: #f1f5f9;
}

.no-spin::-webkit-outer-spin-button,
.no-spin::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.no-spin[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* PWA Offline Indicator Animations */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

#offlineIndicator .animate-pulse {
  animation: pulse-dot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

#syncToast {
  will-change: transform;
}

.offline-saved {
  position: relative;
}

.offline-saved::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 2px solid #f59e0b;
  border-radius: inherit;
  pointer-events: none;
  animation: offline-flash 1s ease-in-out 3;
}

@keyframes offline-flash {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

