@import "../shared.css";

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  padding: 2rem;
  background: var(--page-bg);
  color: var(--text);
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 1.25rem;
}

.topbar,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 1.5rem 2rem;
}

h1 {
  margin: 0;
  color: var(--pesu-blue);
  font-size: 1.5rem;
  font-weight: 700;
}

p {
  margin: 4px 0 0;
  color: var(--muted-foreground);
  font-size: 13px;
}

.actions,
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.filters {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.filters input {
  flex: 1;
}

#status {
  margin-left: auto;
}

.table-wrap {
  overflow: auto;
  position: relative;
  min-height: 320px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--pesu-blue);
  background: #f8fafc;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
}

.course-row {
  cursor: pointer;
  transition: background 0.15s;
}

.course-row:hover {
  background: #f8fafc;
}

td.center {
  text-align: center;
  vertical-align: middle;
}

.hidden-row {
  opacity: 0.5;
}

.hidden-row td:not(.center) {
  text-decoration: line-through;
}

td.center input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  min-height: 0;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--muted);
  position: relative;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  vertical-align: middle;
  outline: none;
}

td.center input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted-foreground);
  transition: transform 0.15s, background 0.15s;
  pointer-events: none;
}

td.center input[type="checkbox"]:checked {
  background: var(--pesu-orange);
  border-color: var(--pesu-orange);
}

td.center input[type="checkbox"]:checked::before {
  transform: translateX(16px);
  background: white;
}

td.center input[type="checkbox"]:focus {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.details {
  display: grid;
  gap: 8px;
  color: #374151;
  line-height: 1.45;
}

.details strong {
  color: var(--pesu-blue);
}

.empty {
  padding: 20px;
  color: var(--muted-foreground);
  text-align: center;
}

.viewer-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  z-index: 5;
  color: var(--muted-foreground);
  font-size: 13px;
}

.viewer-loading[hidden] {
  display: none;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--pesu-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  body {
    padding: 1rem;
  }

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

  #status {
    margin-left: 0;
  }
}
