* {
  box-sizing: border-box;
}

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --border: #e4e7ec;
  --primary: #3157d5;
  --primary-dark: #2545b3;
  --success: #16805d;
  --success-soft: #eaf8f2;
  --warning: #a15c00;
  --warning-soft: #fff4df;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --coming: #667085;
  --coming-soft: #f2f4f7;
  --shadow: 0 14px 40px rgba(16, 24, 40, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(49, 87, 213, 0.08), transparent 32rem),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0 28px;
}

.site-header {
  margin-bottom: 28px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-header h1,
.assignment-toolbar h2,
.section-heading h2,
.student-summary h2 {
  margin: 0;
}

.site-header h1 {
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.05;
}

.header-description,
.section-heading p,
.assignment-toolbar p {
  color: var(--muted);
}

.header-description {
  margin: 12px 0 0;
  font-size: 1.05rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.login-panel {
  padding: 28px;
}

.student-form {
  margin-top: 22px;
}

.field-group label,
.submission-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

input[type="text"],
input[type="url"],
input[type="file"] {
  width: 100%;
}

input[type="text"],
input[type="url"] {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #cfd4dc;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: #fff;
}

input[type="text"]:focus,
input[type="url"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(49, 87, 213, 0.11);
}

input[type="file"] {
  padding: 11px;
  border: 1px dashed #c9ced7;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.btn {
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 750;
  transition: transform 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  color: #fff;
  background: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.btn-full {
  width: 100%;
}

.field-error {
  color: var(--danger);
  margin: 10px 0 0;
  font-size: 0.92rem;
}

.student-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  margin-bottom: 28px;
}

.student-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 16px;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
}

.student-summary h2 {
  font-size: 1.35rem;
}

.student-meta {
  margin-top: 7px;
  color: var(--muted);
}

.meta-dot {
  margin: 0 5px;
}

.assignment-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 2px 18px;
}

.assignment-toolbar p {
  margin: 8px 0 0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.dot-open {
  background: var(--success);
}

.dot-coming {
  background: var(--coming);
}

.dot-closed {
  background: var(--danger);
}

.assignment-list {
  display: grid;
  gap: 18px;
}

.assignment-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
}

.assignment-card-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.assignment-main {
  min-width: 0;
}

.assignment-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.assignment-id {
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(49, 87, 213, 0.08);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.03em;
}

.assignment-status {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-open {
  color: var(--success);
  background: var(--success-soft);
}

.status-coming {
  color: var(--coming);
  background: var(--coming-soft);
}

.status-closed {
  color: var(--danger);
  background: var(--danger-soft);
}

.assignment-title {
  margin: 0;
  font-size: 1.25rem;
}

.assignment-description {
  margin: 9px 0 0;
  color: var(--muted);
  white-space: pre-line;
  line-height: 1.55;
}

.latest-badge {
  align-self: flex-start;
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--success);
  background: var(--success-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.assignment-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.info-item {
  padding: 13px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.info-label,
.latest-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.info-item strong {
  font-size: 0.92rem;
  word-break: break-word;
}

.latest-submission {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #c9eadc;
  border-radius: var(--radius-md);
  background: var(--success-soft);
}

.latest-details {
  color: #376655;
  font-size: 0.88rem;
  text-align: right;
}

.submission-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.submission-fields {
  display: grid;
  gap: 14px;
}

.submission-field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.submit-note {
  margin: 13px 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.submit-note.late {
  color: var(--warning);
}

.submit-note.coming {
  color: var(--coming);
}

.btn-submit {
  width: 100%;
  margin-top: 4px;
}

.empty-state {
  padding: 44px 24px;
  text-align: center;
}

.empty-icon {
  margin-bottom: 10px;
  font-size: 2rem;
}

.empty-state h3 {
  margin: 0;
}

.empty-state p {
  color: var(--muted);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(3px);
}

.loading-box {
  min-width: 220px;
  padding: 28px;
  border-radius: 18px;
  background: #fff;
  text-align: center;
  box-shadow: var(--shadow);
}

.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 14px;
  border: 4px solid #e8ebf1;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-box p {
  margin: 0;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.58);
}

.modal {
  width: min(500px, 100%);
  padding: 28px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.25);
}

.modal-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 16px;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 900;
}

.modal-icon.success {
  color: #fff;
  background: var(--success);
}

.modal h2 {
  margin: 0 0 18px;
}

.modal-content {
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.receipt-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 14px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
}

.receipt-row:last-child {
  border-bottom: 0;
}

.receipt-label {
  color: var(--muted);
}

.receipt-value {
  min-width: 0;
  font-weight: 700;
  word-break: break-word;
}

.site-footer {
  padding: 26px 0 4px;
  color: #98a2b3;
  text-align: center;
  font-size: 0.85rem;
}

@media (max-width: 780px) {
  .page-shell {
    width: min(100% - 22px, 1080px);
    padding-top: 28px;
  }

  .login-panel,
  .assignment-card {
    padding: 19px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .student-summary,
  .assignment-toolbar,
  .assignment-card-top,
  .latest-submission {
    align-items: stretch;
    flex-direction: column;
  }

  .assignment-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .latest-details {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .assignment-info-grid {
    grid-template-columns: 1fr;
  }

  .student-summary {
    padding: 18px;
  }

  .student-info {
    align-items: flex-start;
  }

  .student-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .meta-dot {
    display: none;
  }

  .receipt-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}


/* =========================
   Assignment selector layout
   ========================= */

.assignment-selector-panel {
  padding: 22px 24px;
  margin-bottom: 18px;
}

.assignment-selector-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.assignment-selector-heading h2 {
  margin: 0;
}

.assignment-selector-heading p {
  margin: 8px 0 0;
  color: var(--muted);
}

.assignment-select-wrap {
  margin-top: 18px;
}

.assignment-select-wrap label {
  display: block;
  margin-bottom: 8px;
  font-weight: 750;
}

.assignment-select-wrap select {
  width: 100%;
  min-height: 50px;
  padding: 0 42px 0 14px;
  border: 1px solid #cfd4dc;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 650;
  outline: none;
  cursor: pointer;
}

.assignment-select-wrap select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(49, 87, 213, 0.11);
}

.selected-assignment-container {
  display: grid;
}

.selected-assignment-container .assignment-card {
  margin: 0;
}

@media (max-width: 780px) {
  .assignment-selector-heading {
    align-items: stretch;
    flex-direction: column;
  }
}


.site-footer a {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover {
  text-decoration: underline;
}
