@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

:root {
  --primary: #e86a2f;
  --primary-dark: #d45820;
  --primary-light: #fff3ec;
  --bg: #f7f6f4;
  --surface: #ffffff;
  --border: #e5e5e5;
  --text: #1c1c1c;
  --text-secondary: #555;
  --text-muted: #999;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --t: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── HEADER ──────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  display: flex;
  align-items: center;
  height: 60px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  gap: 8px;
}

.logo a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.logo img { height: 34px; }

/* ── NAV ─────────────────────────────────────── */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.nav-menu > a {
  padding: 6px 14px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--t), color var(--t);
  white-space: nowrap;
}

.nav-menu > a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Dropdown */
.nav-dropdown { position: relative; }

.nav-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: background var(--t), color var(--t);
  white-space: nowrap;
}

.nav-dropdown:hover .nav-dropdown-btn,
.nav-dropdown-btn:focus {
  background: var(--primary-light);
  color: var(--primary);
  outline: none;
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 148px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--t), transform var(--t), visibility var(--t);
  z-index: 200;
  overflow: hidden;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-menu a {
  display: block;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  transition: background var(--t), color var(--t);
}

.nav-dropdown-menu a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ── AUTH HEADER ─────────────────────────────── */
.auth {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 12px;
}

.auth a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  transition: background var(--t), color var(--t);
}

.auth a:hover { background: var(--bg); color: var(--text); }

.auth .btn-auth-primary {
  background: var(--primary);
  color: #fff !important;
  border-radius: 20px;
}

.auth .btn-auth-primary:hover {
  background: var(--primary-dark) !important;
  color: #fff !important;
}

/* ── MAIN ────────────────────────────────────── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* ── BUTTONS ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  text-decoration: none;
  transition: transform var(--t), box-shadow var(--t), background var(--t);
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: none; }

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

.btn-soft { background: var(--primary-light); color: var(--primary); }
.btn-soft:hover { background: #fde5d4; color: var(--primary-dark); }

.btn-light { background: #ff9a62; color: #fff; }
.btn-light:hover { background: #f08040; color: #fff; }

.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-success { background: #22c55e; color: #fff; }
.btn-success:hover { background: #16a34a; color: #fff; }

.btn-neutral { background: #f0f0ee; color: var(--text-secondary); }
.btn-neutral:hover { background: #e4e4e0; color: var(--text); }

.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 13px 24px; font-size: 16px; border-radius: 10px; }

/* ── FORM ────────────────────────────────────── */
.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafaf8;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
  box-sizing: border-box;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232, 106, 47, 0.12);
  background: #fff;
}

.form-group { margin-bottom: 12px; }

/* ── TABLE ───────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.table th {
  background: #f9f9f7;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.table th.left { text-align: left; }

.table td {
  padding: 13px 16px;
  text-align: center;
  border-bottom: 1px solid #f2f2f0;
  font-size: 14px;
  vertical-align: middle;
}

.table td.left { text-align: left; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fdf8f5; }

.table-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── BADGE ───────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success { background: #dcfce7; color: #16a34a; }
.badge-warning { background: #fef9c3; color: #ca8a04; }
.badge-danger  { background: #fee2e2; color: #dc2626; }
.badge-neutral { background: #f3f4f6; color: #6b7280; }

/* ── TOAST ───────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.28s ease forwards;
}

.toast-success { background: #1a1a1a; color: #fff; }
.toast-error   { background: #ef4444; color: #fff; }
.toast-danger  { background: #ef4444; color: #fff; }
.toast-warning { background: #f59e0b; color: #fff; }
.toast-info    { background: #3b82f6; color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── PAGINATION ──────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
}

.pagination a,
.pagination span {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--t), color var(--t), border-color var(--t);
}

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

.pagination a:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

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

/* ── COMMENT CARD ────────────────────────────── */
.comment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), transform var(--t);
}

.comment-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.comment-date {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.comment-content {
  font-size: 16px;
  line-height: 1.75;
  white-space: pre-line;
  color: var(--text);
}

/* ── AUTH PAGE ───────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 40px 20px;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.auth-card .logo-img { height: 90px; margin-bottom: 12px; }
.auth-card h2 { font-size: 22px; font-weight: 700; margin: 0 0 28px; color: var(--text); }
.auth-card .error-msg {
  background: #fee2e2;
  color: #dc2626;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
  text-align: left;
}
.auth-card .form-group { margin-bottom: 10px; }

/* ── PAGE HEADER ─────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

/* ── FILTER BAR ──────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.filter-bar label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.filter-bar select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafaf8;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t);
  min-width: 160px;
}

.filter-bar select:focus { border-color: var(--primary); }

/* ── SECTION CARD ────────────────────────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.section-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text);
}

/* ── INLINE LINK EDIT ────────────────────────── */
.link-edit-inline {
  display: none;
  margin-top: 10px;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.link-edit-input {
  min-width: 240px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
}

/* ── STAGGERED REVEAL ────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── WELCOME BANNER ──────────────────────────── */
.welcome-banner {
  background: linear-gradient(135deg, #e86a2f 0%, #ff9a62 100%);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  color: white;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.welcome-banner::before {
  content: '';
  position: absolute;
  top: -50px; right: -30px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -70px; right: 80px;
  width: 260px; height: 260px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}
.welcome-name {
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 6px;
  position: relative;
}
.welcome-sub {
  font-size: 15px;
  opacity: 0.85;
  position: relative;
}

/* ── HOMEWORK CARD ───────────────────────────── */
.hw-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), transform var(--t);
}
.hw-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.hw-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.hw-date {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.hw-due {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}
.hw-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}
.hw-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.hw-page-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 130px;
  white-space: nowrap;
}
.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fafaf8;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--t), background var(--t), color var(--t);
  flex: 1;
  position: relative;
  overflow: hidden;
}
.file-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.file-btn.has-file {
  border-color: #22c55e;
  background: #f0fdf4;
  color: #16a34a;
  border-style: solid;
}
.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.file-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.hw-card-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.hw-submitted-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: auto;
}

/* ── REPLAY GRID ─────────────────────────────── */
.replay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.replay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), transform var(--t);
  display: flex;
  flex-direction: column;
}
.replay-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.replay-card-date {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.replay-card-password {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.replay-card-comment {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
  margin-bottom: 16px;
}
.replay-card-actions {
  display: flex;
  gap: 8px;
}

/* ── LOGIN BLOB BACKGROUND ───────────────────── */
.login-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  animation: blob-float linear infinite alternate;
}
.login-blob-1 {
  width: 400px; height: 400px;
  background: #e86a2f;
  opacity: 0.12;
  top: -100px; left: -100px;
  animation-duration: 14s;
}
.login-blob-2 {
  width: 300px; height: 300px;
  background: #ff9a62;
  opacity: 0.10;
  bottom: -80px; right: -80px;
  animation-duration: 18s;
  animation-direction: alternate-reverse;
}
.login-blob-3 {
  width: 200px; height: 200px;
  background: #e86a2f;
  opacity: 0.07;
  top: 40%; left: 60%;
  animation-duration: 22s;
}
@keyframes blob-float {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.08); }
}
.auth-page { position: relative; }
.auth-card { position: relative; z-index: 1; }

/* ── LOGIN GREETING ──────────────────────────── */
.login-greeting {
  text-align: center;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}
.login-greeting-emoji {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 8px;
}
.login-greeting-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}
