:root {
  --primary: #3f51b5;
  --bg: #f5f5f5;
  --text: #222;
  --shadow: 0 2px 6px rgba(0,0,0,0.1);
}

body {
  margin: 0;
  font-family: 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: #fff;
  box-shadow: var(--shadow);
  position: relative; /* 로고 중앙 배치 기준 */
}

.app-bar .logo {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none; /* 버튼 클릭 방해 방지 */
}

.status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 0.5rem;
  background: #ccc;
  vertical-align: middle;
}

.status.ok {
  background: #4caf50;
}

.status.error {
  background: #f44336;
}

.app-bar select,
.app-bar button {
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
}

.app-bar .actions {
  margin-left: auto; /* 오른쪽 버튼 영역 고정 */
}

.layout {
  display: flex;
  gap: 1rem;
  padding: 1rem;
}

@media (max-width: 1023px) {
  .layout {
    flex-direction: column;
  }
}

#timetableSection,
#chatSection {
  flex: 1;
}

.timetable,
.overview {
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: auto;
}

.timetable {
  padding: 0.5rem;
}

.grid {
  display: grid;
  grid-template-columns: 80px repeat(5, 1fr);
}

.grid .day-header {
  position: sticky;
  top: 0;
  background: #e8eaf6;
  text-align: center;
  padding: 0.25rem;
  font-weight: 500;
}

.grid .period {
  position: sticky;
  left: 0;
  background: #e8eaf6;
  text-align: center;
  padding: 0.25rem;
  font-weight: 500;
}

.grid .cell {
  border: 1px solid #ddd;
  height: 60px;
  padding: 4px;
  cursor: pointer;
}

.grid .cell:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.grid .cell .subject {
  font-weight: 500;
}

.chat {
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat h2 {
  margin: 1rem;
  font-size: 1.1rem;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 0 1rem;
}

.message {
  margin-bottom: 0.75rem;
}

.message.user {
  text-align: right;
}

.message .bubble {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  border-radius: 16px;
  max-width: 80%;
}

.message.user .bubble {
  background: #e3f2fd;
}

.message.assistant .bubble {
  background: #f1f1f1;
}

.message .time {
  font-size: 0.75rem;
  color: #666;
  display: block;
  margin-top: 2px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1rem 0.5rem;
}

.chip {
  background: #e0e0e0;
  border: none;
  border-radius: 16px;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
}

.chip:focus,
button:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem 1rem;
}

#chatInput {
  flex: 1;
  resize: vertical;
}

#sendBtn {
  padding: 0.5rem 1rem;
}

.modal.hidden,
.overview.hidden {
  display: none;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal .content {
  background: #fff;
  border-radius: 8px;
  padding: 1rem;
  width: 300px;
  max-width: 90%;
}

.modal label {
  display: block;
  margin-top: 0.5rem;
}

.modal input {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.25rem;
}

.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.3s;
}

.toast.show {
  opacity: 1;
}

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

.overview-table th,
.overview-table td {
  border: 1px solid #ddd;
  padding: 4px;
  text-align: center;
  font-size: 0.8rem;
}
