/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --background-color: #121212;
  --surface-color: #1E1E1E;
  --primary-text-color: #E0E0E0;
  --secondary-text-color: #B0B0B0;
  --border-color: #444444;
  --accent-color: #888888;
  --link-color: #0f82af;
  --focus-color: #666666;
  --error-color: #CF6679;
  --success-color: #4CAF50;
  --monitoring-color: #F3CA1D;
}

body {
  background: var(--background-color);
  color: var(--primary-text-color);
  /* font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; */
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  /* line-height: 1.5; */
  margin: 0;
  padding: 1rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: inherit;
}

/* Links */
a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  color: var(--primary-text-color);
  text-decoration: underline;
}

/* Form elements */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--primary-text-color);
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 1rem;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--focus-color);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--secondary-text-color);
}

/* Buttons */
button,
input[type="submit"],
.btn {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--primary-text-color);
  cursor: pointer;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  transition: background 0.15s ease;
}

button:hover,
input[type="submit"]:hover,
.btn:hover {
  background: var(--border-color);
}

button:active,
input[type="submit"]:active,
.btn:active {
  background: var(--focus-color);
}

/* Tables */
table {
  border-collapse: collapse;
  width: 100%;
}

table th,
table td {
  border: 1px solid var(--border-color);
  text-align: left;
  vertical-align: middle;
}

table th {
  background: var(--surface-color);
  color: var(--secondary-text-color);
  font-weight: 600;
}


.sub-column {
  width: 80px;
}

td.sub-column {
  height: 22px;
}

.action-cell {
  padding: 0;
}

.action-cell > div {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  padding: 0px 4px;
  gap: 4px;
}

.action-cell button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

/* Toast notifications */
.toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 4s forwards;
  z-index: 1000;
}

.toast-success {
  background: var(--success-color);
  color: var(--background-color);
}

.toast-error {
  background: var(--error-color);
  color: var(--background-color);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; visibility: hidden; }
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge-pending { background: var(--border-color); color: var(--primary-text-color); }
.badge-enrolled { background: var(--success-color); color: var(--background-color); }
.badge-failed { background: var(--error-color); color: var(--background-color); }
.badge-cancelled { background: var(--secondary-text-color); color: var(--background-color); }
.badge-monitoring { background: var(--monitoring-color); color: var(--background-color); }

/* User form */
.user-form input {
  display: block;
  width: 100%;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
}

.user-form {
  width: 280px;
}

.user-form input:disabled {
  color: var(--secondary-text-color);
  cursor: not-allowed;
}

.user-container {
  max-width: 640px;
  margin: 4rem auto;
}

.user-form-container {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
}

.user-container h1 {
  color: var(--secondary-text-color);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  text-align: center;
}

.user-form input[type="submit"] {
  width: 100%;
  margin-top: 0.5rem;
}

.password-field {
  position: relative;
  margin-bottom: 0.75rem;
}

.password-field input {
  margin-bottom: 0;
  padding-right: 60px;
}

.password-toggle {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  padding: 0 12px;
  font-size: 0.75rem;
  border: none;
  border-radius: 0 4px 4px 0;
  background: var(--border-color);
}

.password-toggle:hover {
  background: var(--focus-color);
}

/* Help icon */
/* Help icon */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.5rem;
  border-radius: 50%;
  background: var(--border-color);
  color: var(--secondary-text-color);
  font-size: 0.75rem;
  font-weight: bold;
  text-decoration: none;
  vertical-align: middle;
}

.help-icon:hover {
  background: var(--focus-color);
  color: var(--primary-text-color);
  text-decoration: none;
}

/* Help page */
.help-container {
  max-width: 480px;
  margin: 2rem auto;
  padding: 0 1rem;
  line-height: 1.6;
}

.help-container h1 {
  margin-bottom: 1.5rem;
}

.help-container h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.help-container p {
  color: var(--secondary-text-color);
}

.help-container :target {
  background: var(--surface-color);
  margin: -0.5rem;
  padding: 0.5rem;
  border-radius: 4px;
  animation: highlight-fade 2s ease-out;
}

@keyframes highlight-fade {
  from { background: var(--border-color); }
  to { background: var(--surface-color); }
}

.help-section, .linked-section {
  scroll-margin-top: 4rem;
}

.help-section + .help-section {
  border-top: 1px solid var(--border-color);
  margin-top: 2rem;
  padding-top: 2rem;
}

/* Login form */
.login-container {
  max-width: 320px;
  margin: 4rem auto;
}

.login-container h1 {
  color: var(--secondary-text-color);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  text-align: center;
}

.login-form input[type="email"],
.login-form input[type="password"] {
  display: block;
  width: 100%;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
}

.login-form input[type="submit"] {
  width: 100%;
  margin-top: 0.5rem;
}

.navbar {
  display: flex;
  justify-content: end;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  margin: -1rem -1rem 1rem -1rem;
  padding-inline: 1rem;
  font-size: 0.75rem;
  color: var(--secondary-text-color);
  background: var(--surface-color);
}

.navbar-sticky {
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar button {
  background: transparent;
  border: none;
  padding: 0.4rem;
  line-height: 0;
  border-radius: 4px;
}

.navbar button:hover {
  background: var(--border-color);
}

.impersonation-banner {
  background: #D7AC61;
  color: #1a1a1a;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  margin: -1rem -1rem 0 -1rem;
  font-size: 0.875rem;
}

.impersonation-banner + .navbar {
  margin-top: 0;
}

.impersonation-banner button {
  background: rgba(0, 0, 0, 0.15);
  border: none;
  color: #1a1a1a;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.impersonation-banner button:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Lesson form */
.lesson-form {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
}

.lesson-form input[type="text"] {
  flex: 1;
  min-width: 0;
  max-width: 400px;
}

/* Table wrapper for horizontal scroll on mobile */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -1rem;
  padding: 0 1rem;
}

/* Stacked cell for mobile (primary + secondary info) */
.cell-primary {
  display: block;
  font-weight: 500;
}

.cell-secondary {
  display: none;
  font-size: 0.75rem;
  color: var(--secondary-text-color);
  margin-top: 2px;
}

/* Star toggle button */
.star-toggle {
  background: none;
  border: none;
  padding: 0;
  line-height: 0;
}

@media (hover: hover) {
  .star-toggle:hover {
    background: none;
  }

  .star-on:hover path {
    fill: none;
  }

  .star-off:hover path {
    fill: white;
  }
}

/* Responsive breakpoints (Primer: 544px, 768px, 1012px) */
@media (max-width: 768px) {
  .user-form-container {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
  }
  body {
    padding: 0.75rem;
  }

  .impersonation-banner {
    margin: -0.75rem -0.75rem 0 -0.75rem;
    padding: 0.5rem 0.75rem;
  }

  .navbar {
    margin: -0.75rem -0.75rem 1rem -0.75rem;
    padding-inline: 0.75rem;
  }

  .lesson-form {
    flex-direction: column;
  }

  .lesson-form input[type="text"] {
    max-width: 100%;
  }

  .table-wrapper {
    margin: 0 -0.75rem;
    padding: 0 0.75rem;
  }

  table {
    font-size: 0.875rem;
  }

  table th,
  table td {
    padding: 8px 6px;
  }

  .cell-stacked {
    white-space: normal;
  }

  .action-cell > div {
    flex-direction: row;
    padding: 6px;
  }

  .action-cell button {
    width: 100%;
  }

  .hide-mobile {
    display: none;
  }

  .cell-secondary {
    display: block;
  }

  .sub-column {
    width: auto;
  }
}

@media (max-width: 544px) {
  h2 {
    font-size: 1.25rem;
  }

  table {
    font-size: 0.75rem;
  }

  table th,
  table td {
    padding: 6px 4px;
  }

  .action-cell button {
    font-size: 0.675rem;
  }
}
