/* ── 교사 협업 포털 ── */
:root {
  --teacher-content-max: min(100%, 960px);
  --teacher-content-gutter: 10px;
}

.teacher-portal {
  position: fixed;
  top: var(--site-header-height, 52px);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10050;
  display: none;
  flex-direction: column;
  background: linear-gradient(165deg, #e8f4fc 0%, #f5f9fc 45%, #eef6f2 100%);
  overflow: hidden;
}

.teacher-portal.is-open {
  display: flex;
}

.teacher-portal__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  width: var(--teacher-content-max);
  max-width: 100%;
  margin: 0 auto;
  padding: 12px var(--teacher-content-gutter);
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  border-radius: 0 0 14px 14px;
}

.teacher-portal__back {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(118, 118, 128, 0.12);
  color: #334155;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.teacher-portal__title-wrap {
  flex: 1;
  min-width: 0;
}

.teacher-portal__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}

.teacher-portal__user {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: #64748b;
}

.teacher-portal__logout {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
}

.teacher-portal__body {
  position: relative;
  flex: 1;
  overflow-y: auto;
  width: var(--teacher-content-max);
  max-width: 100%;
  margin: 0 auto;
  padding: 14px var(--teacher-content-gutter);
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.teacher-portal__loading {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, 0.82);
  backdrop-filter: blur(2px);
}

.teacher-portal__loading[hidden] {
  display: none !important;
}

.teacher-portal__loading-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  font-size: 0.88rem;
  font-weight: 700;
  color: #334155;
}

.teacher-portal__spinner {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border: 2.5px solid rgba(14, 165, 233, 0.25);
  border-top-color: #0284c7;
  border-radius: 50%;
  animation: teacher-portal-spin 0.65s linear infinite;
}

@keyframes teacher-portal-spin {
  to {
    transform: rotate(360deg);
  }
}

.teacher-portal__tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.teacher-portal__tab {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
}

.teacher-portal__tab.is-active {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  border-color: transparent;
  color: #fff;
}

.teacher-portal__panel {
  display: none;
}

.teacher-portal__panel.is-active {
  display: block;
}

.teacher-auth-card {
  max-width: 100%;
  margin: 16px auto 24px;
  padding: 20px 18px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

.teacher-auth-card h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
}

.teacher-auth-card__lead {
  margin: 0 0 16px;
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.45;
}

.teacher-auth-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.teacher-auth-switch button {
  flex: 1;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #f8fafc;
  font-weight: 700;
  cursor: pointer;
}

.teacher-auth-switch button.is-active {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}

.teacher-form-field {
  margin-bottom: 12px;
}

.teacher-form-field label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
}

.teacher-form-field input,
.teacher-form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  font-family: inherit;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.teacher-form-field textarea {
  min-height: 100px;
  resize: vertical;
}

.teacher-btn {
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
}

.teacher-btn--primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #fff;
}

.teacher-btn--secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid rgba(15, 23, 42, 0.1);
}

.teacher-btn:disabled,
.teacher-btn.is-loading {
  opacity: 0.72;
  cursor: wait;
  pointer-events: none;
}

.teacher-btn.is-loading::before {
  content: '';
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin-right: 0.4em;
  vertical-align: -0.12em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: teacher-portal-spin 0.65s linear infinite;
}

.teacher-wall-compose.is-busy {
  opacity: 0.88;
  pointer-events: none;
}

.teacher-upload-box.is-busy {
  opacity: 0.88;
  pointer-events: none;
}

.teacher-msg {
  margin: 10px 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
}

.teacher-msg--error {
  color: #dc2626;
}

.teacher-msg--ok {
  color: #16a34a;
}

.teacher-pending-card {
  max-width: 100%;
  margin: 24px auto;
  padding: 24px 20px;
  text-align: center;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.teacher-pending-card h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.teacher-pending-card p {
  margin: 0;
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.5;
}

.teacher-post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── 패들렛형 아이디어 담벼락 ── */
.teacher-ideas-wall-wrap {
  width: 100%;
}

.teacher-ideas-wall {
  column-count: 3;
  column-gap: 14px;
}

@media (max-width: 820px) {
  .teacher-ideas-wall {
    column-count: 2;
  }
}

@media (max-width: 520px) {
  .teacher-ideas-wall {
    column-count: 1;
  }
}

.teacher-wall-note {
  break-inside: avoid;
  margin-bottom: 14px;
  padding: 14px 14px 12px;
  border-radius: 4px 14px 14px 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow:
    2px 3px 0 rgba(15, 23, 42, 0.06),
    0 8px 20px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.teacher-wall-note:hover {
  transform: translateY(-3px) rotate(0deg) !important;
  box-shadow:
    2px 4px 0 rgba(15, 23, 42, 0.08),
    0 12px 28px rgba(15, 23, 42, 0.12);
}

.teacher-wall-note--compose {
  cursor: default;
  background: rgba(255, 255, 255, 0.85);
  border: 2px dashed rgba(14, 165, 233, 0.45);
  box-shadow: none;
  transform: none !important;
  margin-bottom: 18px;
}

.teacher-wall-note--compose:hover {
  transform: none;
  box-shadow: none;
}

.teacher-wall-note--compose .teacher-form-field textarea {
  min-height: 72px;
}

.teacher-wall-note__title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
}

.teacher-wall-note__heading {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
}

.teacher-wall-note__body {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: #334155;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.teacher-wall-note__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 0.72rem;
  color: #64748b;
}

.teacher-wall-note__like {
  font-weight: 700;
  color: #b45309;
}

.teacher-wall-note--c0 { background: linear-gradient(145deg, #fef9c3 0%, #fef08a 100%); transform: rotate(-1.2deg); }
.teacher-wall-note--c1 { background: linear-gradient(145deg, #d1fae5 0%, #a7f3d0 100%); transform: rotate(0.8deg); }
.teacher-wall-note--c2 { background: linear-gradient(145deg, #e0f2fe 0%, #bae6fd 100%); transform: rotate(-0.6deg); }
.teacher-wall-note--c3 { background: linear-gradient(145deg, #ffedd5 0%, #fed7aa 100%); transform: rotate(1deg); }
.teacher-wall-note--c4 { background: linear-gradient(145deg, #ede9fe 0%, #ddd6fe 100%); transform: rotate(-0.9deg); }
.teacher-wall-note--c5 { background: linear-gradient(145deg, #fce7f3 0%, #fbcfe8 100%); transform: rotate(0.5deg); }

.teacher-wall-note__submit {
  margin-top: 4px;
}

.teacher-ideas-wall__empty {
  column-span: all;
  padding: 24px 16px;
  text-align: center;
  font-size: 0.88rem;
  color: #64748b;
}

.teacher-wall-modal {
  position: fixed;
  inset: 0;
  z-index: 10100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: calc(var(--site-header-height, 52px) + 12px);
  box-sizing: border-box;
}

.teacher-wall-modal:not([hidden]) {
  display: flex;
}

.teacher-wall-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.teacher-wall-modal__card {
  position: relative;
  width: min(100%, 520px);
  max-height: min(78vh, 640px);
  overflow-y: auto;
  padding: 20px 18px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

.teacher-files-intro {
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.45;
}

.teacher-post-item {
  padding: 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.teacher-post-item:hover {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.teacher-post-item__title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
}

.teacher-post-item__meta {
  font-size: 0.75rem;
  color: #94a3b8;
}

.teacher-post-item__preview {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: #64748b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.teacher-post-detail {
  max-width: 100%;
  margin: 0 auto;
}

.teacher-post-detail__back {
  margin-bottom: 12px;
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: #0284c7;
  font-weight: 700;
  cursor: pointer;
}

.teacher-post-detail__title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 900;
  color: #0f172a;
}

.teacher-post-detail__body {
  margin: 0 0 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #334155;
  white-space: pre-wrap;
}

.teacher-like-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.teacher-like-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.teacher-like-btn.is-liked {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #b45309;
}

.teacher-comments {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.teacher-comments h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.teacher-comment {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 0.85rem;
}

.teacher-comment__meta {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-bottom: 4px;
}

.teacher-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.teacher-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.teacher-file-item a {
  color: #0284c7;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.88rem;
}

.teacher-file-item__meta {
  font-size: 0.72rem;
  color: #94a3b8;
}

.teacher-upload-box {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px dashed rgba(15, 23, 42, 0.18);
}

.teacher-upload-box h3 {
  margin: 0 0 10px;
  font-size: 0.92rem;
}

.teacher-admin-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.teacher-admin-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 0.85rem;
}

.teacher-admin-list button {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #f8fafc;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.teacher-admin-section {
  margin-bottom: 20px;
}

.teacher-admin-section__lead {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: #64748b;
}

.teacher-admin-list--members li.teacher-admin-member {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.teacher-admin-member__main {
  min-width: 0;
  flex: 1;
}

.teacher-admin-member__name {
  display: block;
  font-size: 0.88rem;
  color: #0f172a;
}

.teacher-admin-member__meta {
  display: block;
  margin-top: 3px;
  font-size: 0.74rem;
  color: #64748b;
}

.teacher-admin-member__role {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.72rem;
  font-weight: 800;
}

.teacher-admin-section h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.teacher-api-warn {
  max-width: 100%;
  margin: 12px auto 20px;
  padding: 14px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  font-size: 0.82rem;
  color: #9a3412;
  line-height: 1.45;
}

body.teacher-portal-open {
  overflow: hidden;
}
