.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-variation-settings:
    "FILL" 1,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
  font-size: 22px;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}

:root {
  --color-primary: #0d7ff2;
  --color-primary-hover: #0b6bcb;
  --color-bg: #f5f7f8;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-white: #fff;
  --font-main: "Plus Jakarta Sans", Arial, sans-serif;
  --star-color: #d81b60; /* Dark pink in light mode */
}

body.dark-mode {
  --color-primary: #3b82f6;
  --color-primary-hover: #60a5fa;
  --color-bg: #121212;
  --color-text: #f8fafc;
  --color-text-muted: #94a3b8;
  --color-border: #334155;
  --color-white: #1e1e1e;
  --star-color: #fff; /* White in dark mode */
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--color-text);
  background: var(--color-bg);
}
.hidden {
  display: none !important;
}

.pagina {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 288px;
  height: 100vh;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.patente {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 6px;
}
.patente__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(13, 127, 242, 0.1);
  color: #0d7ff2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.patente__title {
  font-weight: 700;
  font-size: 18px;
}
.patente__subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: -10px;
}
.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 0 6px;
  margin-top: 8px;
}
.menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.menu__item {
  border: 0;
  background: transparent;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: #475569;
  font-weight: 500;
  text-align: left;
}
.menu__item:hover {
  background: #f1f5f9;
}
.menu__item.is-active {
  background: rgba(13, 127, 242, 0.1);
  color: #0d7ff2;
}
.menu__icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu__label {
  font-size: 14px;
  font-weight: 600;
}
.sidebar-auth {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
.profile-mini__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-mini__avatar .material-symbols-outlined {
  font-size: 22px;
}
.profile-mini__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-mini__label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.profile-mini__name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: block;
  text-align: center;
  text-decoration: none;
}
.btn:visited {
  color: inherit;
}
.btn--primary,
.btn--primary:visited {
  border: 0;
  background: #0d7ff2;
  color: #fff;
}
.btn--primary:hover {
  background: #0b6bcb;
}
.btn--outline {
  background: transparent;
  border: 1px solid #e2e8f0;
  color: #334155;
}
.btn--outline:hover {
  background: #f8fafc;
}
.btn--large {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 18px 40px;
  font-size: 18px;
  border-radius: 14px;
}
.btn--large .material-symbols-outlined {
  font-size: 28px;
}
.btn--white {
  background: #fff;
  color: #2563eb;
  border: none;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn--white:hover {
  background: #eff6ff;
}

.main {
  flex: 1;
  padding: 18px;
}
.topbar {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.icon-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}
.content {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  min-height: 95vh;
  display: flex;
  flex-direction: column;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 22px;
}
.auth-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.auth-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}
.auth-subtitle {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 13px;
}
.auth-form .btn {
  margin-top: 6px;
}
.auth-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 13px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.link {
  color: #0d7ff2;
  text-decoration: none;
  font-weight: 700;
}
.link:hover {
  text-decoration: underline;
}
.sep {
  color: #cbd5e1;
}

.field input {
  height: 44px;
  padding: 0 14px;
  font-size: 0.95rem;
  font-family: inherit;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
}
.field input:focus {
  outline: none;
  border-color: #0d7ff2;
}
.field input:invalid {
  border-color: #dc2626;
  background: #fff7f7;
}
.field input:valid {
  border-color: #16a34a;
}
.field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}
.input-wrap {
  position: relative;
  width: 100%;
}
.input-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  font-size: 22px;
}

.input-wrap input.with-icon {
  padding-left: 44px;
  width: 100%;
}
.input-wrap input[type="password"] {
  padding-right: 44px;
}

#view-dashboard {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
}

.section-header {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #0f172a;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.card {
  border-radius: 20px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card__title {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 8px;
}
.card__desc {
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  opacity: 0.9;
}

.card--hero {
  grid-column: 1/-1;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  min-height: 200px;
  flex-direction: row;
  align-items: center;
}
.card--hero .card__content {
  flex: 1;
  padding-right: 20px;
}
.card--hero .card__title {
  font-size: 24px;
}
.card--hero .card__action {
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.card--review {
  background: #1e293b;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
}
.card--review.is-expanded {
  grid-column: 1 / -1;
  flex: 1;
  cursor: default;
  max-height: 60vh;
  overflow-y: auto;
}

.sfide-panel {
  background: #0f172a;
  color: #fff;
  border-radius: 16px;
  padding: 18px;
}
.review-panel {
  width: 100%;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}
.review-filters {
  display: flex;
  gap: 8px;
}
.review-filter-btn {
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.review-filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.review-filter-btn.is-active {
  background: #0d7ff2;
  border-color: #0d7ff2;
}
.review-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 40vh;
  padding-right: 4px;
}
.review-q-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
}
.review-q-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: #0d7ff2;
}
.review-q-item label {
  flex: 1;
  cursor: pointer;
}
.challenge-box {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.challenge-create {
  display: flex;
  gap: 8px;
}
.challenge-create input {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 10px;
  padding: 0 12px;
  height: 42px;
  font-family: inherit;
}
.challenge-create input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}
.challenge-create .btn {
  width: auto;
  min-width: 120px;
  padding: 10px 14px;
}
.challenge-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.challenge-item {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.challenge-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.challenge-item__state {
  color: #cbd5e1;
  font-size: 12px;
}
.challenge-item__meta {
  margin-top: 6px;
  color: #cbd5e1;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.challenge-play {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.challenge-play:hover {
  background: rgba(255, 255, 255, 0.2);
}

.card__icon-box {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: auto;
}
.card__icon-box--review {
  background: #f97316;
}
.review-start-icon {
  vertical-align: middle;
  margin-right: 6px;
}

.card.is-locked {
  cursor: default;
}

.card.is-locked .card__content,
.card.is-locked .card__text,
.card.is-locked .card__icon-box,
.card.is-locked .card__title,
.card.is-locked .card__desc {
  filter: blur(5px);
  opacity: 0.6;
}

.card__lock-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 20;
  padding: 16px;
  color: #fff;
}
.card.is-locked .card__lock-overlay {
  display: flex;
}
.card__lock-icon {
  font-size: 32px;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.2);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.card__lock-text {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  max-width: 80%;
}

.stats-section {
  margin-top: auto;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stat-box {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.stat-icon {
  font-size: 28px;
}
.stat-icon--quiz {
  color: #0d7ff2;
}
.stat-icon--success {
  color: #22c55e;
}
.stat-icon--warn {
  color: #f59e0b;
}
.stat-icon--error {
  color: #ef4444;
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
}

.storico-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  margin-bottom: 10px;
  padding: 16px;
}
.storico-item.has-detail {
  cursor: pointer;
}
.storico-item.has-detail:hover {
  background: #f8fafc;
}
.storico-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.storico-title {
  font-weight: 700;
  font-size: 16px;
}
.storico-meta {
  font-size: 13px;
  color: #64748b;
  margin-left: auto;
}
.storico-espandi {
  color: #94a3b8;
  margin-left: 8px;
}
.storico-detail {
  margin-top: 14px;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.storico-q {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 14px;
}
.storico-q__body {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.storico-q__text {
  font-size: 14px;
  line-height: 1.4;
}
.storico-q__ans {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
  padding-left: 26px;
}
.storico-q__img {
  margin-top: 6px;
  padding-left: 26px;
}
.storico-thumb {
  max-width: 120px;
  max-height: 80px;
  object-fit: contain;
  border-radius: 6px;
}

#storico-list,
#ostiche-list {
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  padding-right: 4px;
}

.ostica-rank {
  font-weight: 800;
  font-size: 16px;
  color: #0d7ff2;
  min-width: 30px;
}
.ostiche-description {
  color: #64748b;
  margin-bottom: 16px;
  font-size: 14px;
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-110%);
    transition: transform 0.2s;
    z-index: 40;
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .topbar {
    display: flex;
  }
  .main {
    padding: 12px;
  }
  .content {
    min-height: 90vh;
  }
}
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .card--hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .card--hero .card__action {
    margin-top: 16px;
    width: 100%;
  }
  .card--hero .btn--white {
    width: 100%;
    justify-content: center;
  }
  .challenge-create {
    flex-direction: column;
  }
  .challenge-create .btn {
    width: 100%;
  }
}
