:root {
  color-scheme: light;
  --app-bg: #141414;
  --app-surface: #202020;
  --app-surface-raised: #2a2a2a;
  --app-text: #f7f7f7;
  --app-muted: #b8b8b8;
  --app-accent: #e02b20;
  --app-accent-dark: #b91f17;
  --app-focus: #ffb4ae;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--app-focus);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

/* Autenticação */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 10%, rgba(224, 43, 32, .25), transparent 36rem),
    linear-gradient(145deg, #090909 0%, #171717 55%, #260b09 100%) !important;
  color: #242424;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.auth-page .container-login {
  width: 100%;
  max-width: 34rem;
  margin: auto;
  padding: 1.25rem;
}

.auth-page .row {
  margin-right: 0;
  margin-left: 0;
}

.auth-page [class*="col-"] {
  padding-right: 0;
  padding-left: 0;
  max-width: 100%;
  flex: 0 0 100%;
}

.auth-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12) !important;
  border-radius: 1.25rem !important;
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, .42) !important;
}

.auth-page .login-form {
  padding: clamp(1.5rem, 7vw, 3rem) !important;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-bottom: 1.75rem;
  color: #181818;
}

.auth-brand img {
  width: 2.6rem;
  height: 2.6rem;
  object-fit: contain;
}

.auth-brand span {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.auth-subtitle {
  max-width: 26rem;
  margin: -.75rem auto 1.5rem;
  color: #6b7280;
  text-align: center;
}

.auth-page .form-control {
  min-height: 3rem;
  border-radius: .75rem;
}

.auth-page .btn {
  min-height: 3rem;
  border-radius: .75rem;
  font-weight: 700;
}

.auth-page .btn-primary,
.app-install-button {
  border-color: var(--app-accent) !important;
  background: var(--app-accent) !important;
}

.auth-page .btn-primary:hover,
.auth-page .btn-primary:focus,
.app-install-button:hover,
.app-install-button:focus {
  border-color: var(--app-accent-dark) !important;
  background: var(--app-accent-dark) !important;
}

.auth-install {
  width: 100%;
  margin-top: .75rem;
  border: 0;
  color: #fff;
}

/* Área do aluno */
.student-app {
  color-scheme: dark;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--app-bg);
}

.app-header {
  padding-top: calc(1rem + env(safe-area-inset-top)) !important;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(20, 20, 20, .92) !important;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: #fff;
  font-weight: 800;
  letter-spacing: -.02em;
}

.brand-lockup:hover {
  color: #fff;
}

.brand-lockup img {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
}

.profile-button {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: #262626;
  color: #fff;
}

.profile-button img {
  width: 1.65rem;
  height: 1.65rem;
  object-fit: contain;
}

.course-card {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 .75rem 2rem rgba(0, 0, 0, .16);
}

.course-card h3 {
  display: -webkit-box;
  min-height: 2.5rem;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.course-card img {
  display: block;
}

.course-action {
  min-height: 2.5rem;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.student-modal {
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.student-modal > div {
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}

.lesson-item {
  min-width: 0;
}

.lesson-item > div:last-child {
  min-width: 0;
}

.lesson-item h4 {
  overflow-wrap: anywhere;
}

.player-controls button,
.player-controls select,
.player-controls input {
  min-height: 2.75rem;
}

.player-controls input[type="range"] {
  min-height: 1.5rem;
}

/* Administração */
.admin-menu-button {
  display: none;
}

.admin-shell .table-responsive {
  -webkit-overflow-scrolling: touch;
}

@media (hover: hover) and (pointer: fine) {
  .course-card:hover {
    transform: translateY(-4px) scale(1.015) !important;
  }
}

@media (max-width: 767.98px) {
  .auth-page {
    align-items: flex-start;
  }

  .auth-page .container-login {
    padding: 1rem;
  }

  .auth-card {
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
  }

  .app-header {
    padding-right: 1rem !important;
    padding-left: 1rem !important;
  }

  .brand-lockup span {
    font-size: 1.1rem;
  }

  .student-main {
    padding-right: 1rem !important;
    padding-left: 1rem !important;
  }

  .student-banner {
    margin-bottom: 1.75rem !important;
  }

  .student-banner img {
    min-height: 11rem;
  }

  .student-banner h1 {
    max-width: 90%;
    font-size: clamp(1.5rem, 8vw, 2.5rem) !important;
    line-height: 1.1;
  }

  .player-layout {
    display: block !important;
    padding: 1rem !important;
  }

  .player-controls {
    gap: .75rem !important;
  }

  .player-controls > * {
    flex: 1 1 auto;
  }

  .lesson-thumbnail {
    flex: 0 0 4.25rem;
    width: 4.25rem !important;
  }

  .admin-menu-button {
    position: fixed;
    top: calc(.75rem + env(safe-area-inset-top));
    left: .75rem;
    z-index: 1050;
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: .65rem;
    box-shadow: 0 .35rem 1rem rgba(0, 0, 0, .2);
    background: #4c60da;
    color: #fff;
  }

  .admin-shell #content-wrapper {
    min-width: 0;
  }

  .admin-shell .topbar {
    min-height: 4.25rem;
    padding-left: 4.25rem;
  }

  .admin-shell #content > .container-fluid,
  .admin-shell #content-wrapper .container-fluid {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .admin-shell .container-fluid > .d-sm-flex:first-child,
  .admin-shell .container-fluid > a:first-child {
    margin-top: 4.25rem !important;
  }

  .admin-shell .d-flex.justify-content-between,
  .admin-shell .d-sm-flex.justify-content-between {
    gap: .75rem;
    align-items: flex-start !important;
  }

  .admin-shell .d-flex.justify-content-between > div {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
  }

  .admin-shell .list-group-item {
    gap: .75rem;
    align-items: flex-start !important;
  }

  .admin-shell .table {
    white-space: nowrap;
  }

  .admin-shell .modal-dialog {
    margin: max(.75rem, env(safe-area-inset-top)) .75rem;
    max-width: calc(100% - 1.5rem);
  }
}

@media (max-width: 420px) {
  .admin-shell .d-flex.justify-content-between,
  .admin-shell .d-sm-flex.justify-content-between,
  .admin-shell .list-group-item {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
