﻿:root {
  color-scheme: dark;
  --bg: #0d1116;
  --surface: #12181f;
  --surface-strong: #191f26;
  --border: #243a48;
  --text: #e9edf3;
  --muted: #9fb4c8;
  --accent: #1db46f;
  --accent-soft: rgba(29, 180, 111, 0.18);
  --empty: #16222c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "ヒラギノ角ゴ Pro W3", "Yu Gothic", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.page-header {
  padding: 32px 20px 16px;
  background: linear-gradient(135deg, #070b10 0%, #07362c 100%);
  color: #ffffff;
}

.page-title h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 2.5vw, 2.6rem);
}

.page-title p {
  margin: 0;
  max-width: 720px;
  color: rgba(255, 255, 255, 0.88);
}

.page-content {
  padding: 24px 16px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.timetable-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
  width: min(100%, 1400px);
}

.panel-header h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
}

.filters {
  margin-top: 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.filters label {
  font-weight: 500;
  color: var(--text);
}

.filters select {
  padding: 8px 12px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
}

.filters select:focus {
  outline: none;
  border-color: var(--accent);
}

.timetable-wrapper {
  overflow-x: auto;
  margin-top: 24px;
}

.timetable {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 528px;
}

.timetable thead th:not(:first-child) {
  border: 1px solid var(--border);
  padding: 16px 16px;
  text-align: center;
  vertical-align: middle;
  min-height: 80px;
  height: 80px;
}

.timetable tbody td {
  border: 1px solid var(--border);
  padding: 16px 16px;
  text-align: left;
  vertical-align: top;
  min-width: 80px;
  min-height: 170px;
  height: 170px;
}

.timetable tbody th {
  width: 128px;
  background: #141f28;
  font-weight: 700;
}

.timetable td {
  background: var(--surface);
  color: var(--text);
}

.timetable td.empty {
  background: var(--empty);
  color: var(--muted);
  font-style: italic;
}

.timetable td:not(.empty) {
  position: relative;
}

.add-button {
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px dashed var(--accent);
  border-radius: 14px;
  background: rgba(29, 180, 111, 0.14);
  color: var(--accent);
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.add-button:hover {
  background: rgba(29, 180, 111, 0.24);
  transform: translateY(-1px);
}

.add-button:focus-visible {
  outline: 3px solid rgba(29, 180, 111, 0.3);
  outline-offset: 2px;
}

.timetable td:not(.empty) > * {
  position: relative;
}

.timetable td:not(.empty)::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: var(--accent-soft);
  opacity: 0.7;
  pointer-events: none;
}

.online-slot {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-strong);
}

.online-slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.online-slot h3 {
  margin: 0;
  font-size: 1.2rem;
}

.online-slot p {
  margin: 0;
  color: var(--muted);
}

.online-slot-list {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.online-slot-empty {
  color: var(--muted);
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.course-panel,
.selected-classes-panel {
  margin-top: 24px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-strong);
}

.course-list,
.selected-classes-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.course-loading,
.course-load-error,
.selected-classes-empty {
  color: var(--muted);
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.course-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: var(--surface);
}

.course-card-main {
  display: grid;
  gap: 8px;
}

.course-card-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
  z-index: 20;
}

.modal-content {
  width: min(960px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.modal-search-row {
  display: grid;
  gap: 12px;
  margin: 18px 0 6px;
}

.modal-search,
.modal-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-search input,
.modal-filter select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--text);
}

.modal-search input::placeholder {
  color: var(--muted);
}

.modal-filter label {
  color: var(--muted);
  font-size: 0.95rem;
}

.course-info-panel {
  margin: 16px 0 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
}

.course-info-panel-inline {
  margin-top: 14px;
  padding: 16px;
}

.course-info-header h3 {
  margin: 0 0 8px;
}

.course-info-meta {
  color: var(--muted);
  margin: 0;
}

.course-info-field {
  margin-top: 12px;
}

.course-info-field strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.course-info-field p,
.course-info-field a {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.course-info-field a {
  color: var(--accent);
  text-decoration: none;
}

.course-info-field a:hover {
  text-decoration: underline;
}

.course-info-trigger {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.course-info-trigger:hover {
  opacity: 0.9;
}

@media (min-width: 720px) {
  .modal-search-row {
    grid-template-columns: 1.5fr 0.8fr;
    align-items: flex-end;
  }
}

.modal-search input::placeholder {
  color: var(--muted);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}

.modal-content h2 {
  margin-top: 0;
}

.modal-content .course-list {
  margin-top: 20px;
}

.course-card-heading h3 {
  margin: 0;
  font-size: 1.05rem;
}

.course-card-heading span {
  color: var(--muted);
  font-size: 0.95rem;
}

.course-card-teacher {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.selected-course-item {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: var(--surface);
}

.selected-course-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.selected-course-title {
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.course-detail-trigger {
  cursor: pointer;
}

.course-detail-trigger:hover,
.selected-course-title:hover {
  color: var(--accent);
}

.course-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 10px;
  height: 100%;
  min-height: 120px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(29, 180, 111, 0.14);
  flex-wrap: wrap;
  overflow: hidden;
}

.course-name {
  color: var(--text);
  font-weight: 700;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

.course-cell .remove-button {
  flex: 0 0 auto;
}

.selected-course-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

.online-slot-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 18px 20px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.online-slot-item-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.online-slot-label {
  font-weight: 700;
  color: var(--text);
}

.online-slot-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.remove-button {
  min-width: 108px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.remove-button:hover {
  background: rgba(0, 103, 79, 0.08);
  border-color: var(--accent);
  color: var(--accent);
}

.panel-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.share-button,
.reset-button {
  min-width: 140px;
  padding: 10px 14px;
}

.share-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.share-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 720px) {
  .panel-header-actions {
    flex-direction: column;
  }

  .share-button,
  .reset-button,
  .remove-button,
  .add-button {
    width: 100%;
    min-width: 0;
  }

  .course-card-heading,
  .selected-course-main,
  .online-slot-item-main {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-content {
    padding: 18px;
  }

  .course-card {
    padding: 16px;
  }

  .online-slot-item,
  .selected-course-item {
    padding: 14px;
  }
}

@media (max-width: 820px) {
  .page-header {
    padding: 24px 16px 14px;
  }

  .page-content {
    padding: 18px 12px 32px;
  }

  .timetable th,
  .timetable td {
    padding: 12px 10px;
  }
}

@media (max-width: 640px) {
  .timetable {
    min-width: 100%;
    table-layout: auto;
  }

  .timetable thead th,
  .timetable tbody th,
  .timetable td {
    font-size: 0.95rem;
    padding: 10px 8px;
    min-width: 140px;
  }

  .course-panel,
  .selected-classes-panel,
  .online-slot {
    padding: 16px;
  }
}

/* 警告モーダルのスタイル */
.warning-modal-content {
  width: min(500px, 100%);
  max-height: none;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#warningTitle {
  margin: 0;
  font-size: 1.5rem;
  color: #ff6b6b;
}

.warning-message {
  padding: 18px;
  border-left: 4px solid #ff6b6b;
  background: rgba(255, 107, 107, 0.08);
  border-radius: 12px;
}

.warning-message p {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 500;
}

.warning-message p:first-child {
  margin-bottom: 10px;
  font-weight: 700;
  color: #ff6b6b;
}

.modal-button {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.modal-button:hover {
  background: #1a9e62;
}

.modal-button:focus-visible {
  outline: 3px solid rgba(29, 180, 111, 0.3);
  outline-offset: 2px;
}

.total-credits-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(29, 180, 111, 0.08);
  font-size: 1rem;
}

.total-credits-value {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.2rem;
}
