/* Page layout */
.learning-page {
  padding-top: 172px;
  padding-bottom: 60px;
  min-height: 100vh;
  background: #fff;
}

@media (max-width: 768px) {
  .learning-page {
    padding-bottom: 126px;
  }
}

.mypage-sub-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  padding: 26px 0 44px;
}

.mypage-sub-aside {
  min-width: 0;
}

.learning-wrap {
  display: grid;
  gap: 18px;
}

.learning-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sub);
  font-size: 13px;
  font-weight: 800;
}

.learning-breadcrumb a {
  color: var(--millie-deep);
}

.learning-breadcrumb span::before {
  content: ">";
  margin-right: 8px;
  color: var(--muted);
}

.learning-summary {
  display: grid;
  gap: 16px;
  padding: 22px;
  border-radius: 14px;
}

.learning-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.learning-summary-copy {
  display: grid;
  gap: 6px;
}

.learning-summary-copy strong {
  color: var(--millie-deep);
  font-size: 20px;
  font-weight: 900;
}

.learning-summary-copy span {
  color: var(--sub);
  font-size: 14px;
  font-weight: 800;
}

.learning-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.learning-overview-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #f0ebe3;
}

.learning-overview-card.subscription {
  background: linear-gradient(135deg, #fff9dc 0%, #fff 100%);
  border-color: rgba(162, 135, 0, .14);
}

.learning-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.learning-card-head h3 {
  font-size: 15px;
  font-weight: 900;
  color: var(--text);
}

.learning-card-head div > span {
  display: block;
  margin-top: 4px;
  color: var(--sub);
  font-size: 12px;
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f3ede4;
  color: var(--millie-deep);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.submitted {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-pill.incomplete {
  background: #fff0e8;
  color: #e05a00;
}

.learning-subscription-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}

.learning-subscription-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.learning-subscription-cover {
  width: 54px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  flex-shrink: 0;
  border-radius: 7px;
  background: #ffe500;
  box-shadow: 0 8px 16px rgba(31, 26, 22, .12);
}

.learning-subscription-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.learning-progress-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.learning-progress-summary span {
  color: var(--sub);
  font-size: 12px;
  font-weight: 900;
}

.learning-progress-summary strong {
  color: var(--millie-deep);
  font-size: 20px;
  font-weight: 900;
}

.learning-progress-summary .bar {
  grid-column: 1 / -1;
  margin-top: 0;
}

.learning-requirement-grid {
  display: grid;
  gap: 8px;
}

.learning-requirement-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(31, 26, 22, .06);
}

.learning-requirement-item span {
  color: var(--sub);
  font-size: 12px;
  font-weight: 800;
}

.learning-requirement-item strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.learning-posts {
  display: grid;
  gap: 8px;
}

.learning-posts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.learning-posts-head strong {
  font-size: 13px;
  font-weight: 900;
}

.learning-posts-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.learning-posts-empty {
  padding: 12px;
  border-radius: 12px;
  background: #fffdf6;
  border: 1px solid rgba(31, 26, 22, .06);
  color: var(--sub);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.learning-paper-list {
  display: grid;
  gap: 10px;
}

.learning-paper-row {
  display: grid;
  grid-template-columns: auto 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border-radius: 14px;
  background: #fffdf6;
  border: 1px solid rgba(31, 26, 22, .06);
  text-align: left;
  cursor: pointer;
}

.paper-row-cover {
  width: 52px;
  aspect-ratio: auto;
  overflow: hidden;
  border-radius: 7px;
  background: #f8f4e9;
  box-shadow: 0 8px 14px rgba(31, 26, 22, .10);
}

.paper-row-cover img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.learning-paper-row strong {
  display: block;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.learning-paper-row em {
  display: block;
  margin-top: 3px;
  color: var(--sub);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

/* Filters */
.learning-filter {
  padding: 20px 24px;
  border-radius: 14px;
  display: grid;
  gap: 14px;
}

.filter-row[hidden] { display: none; }
.learning-active-header[hidden] { display: none; }

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--sub);
  min-width: 36px;
}

.sort-label {
  margin-left: 16px;
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chips .chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  background: #f3ede4;
  color: var(--sub);
  border: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.filter-chips .chip.active {
  background: var(--millie-deep);
  color: #fff;
}

.filter-select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid #e0d8cc;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}

/* List */
.learning-list {
  display: grid;
  gap: 0;
}

.learning-empty {
  padding: 60px 0;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.app-card {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid #f0ebe3;
  align-items: start;
  transition: background .2s;
}

.app-card:last-child {
  border-bottom: none;
}

.app-card-highlight {
  background: #fff9dc;
}

.app-cover {
  width: 90px;
  aspect-ratio: auto;
  border-radius: 8px;
  overflow: hidden;
  background: #f8f4e9;
  box-shadow: 0 8px 18px rgba(31, 26, 22, .12);
  flex-shrink: 0;
}

.app-cover img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.app-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--millie-deep);
  text-align: center;
  padding: 8px;
  line-height: 1.3;
}

.app-cover-subscription {
  background: #ffe500;
  border: 1px solid rgba(162, 135, 0, .18);
  box-shadow: 0 8px 18px rgba(95, 73, 15, .10);
}

.app-body {
  min-width: 0;
}

.app-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.badge-type-millie,
.badge-type-paper,
.badge-round,
.badge-status-pending,
.badge-status-completed,
.badge-discount {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
}

.badge-type-millie {
  background: var(--millie-deep);
  color: #fff;
}

.badge-type-paper {
  background: #e8e0d4;
  color: var(--millie-deep);
}

.badge-round {
  font-weight: 700;
  background: #f3ede4;
  color: var(--sub);
}

.badge-status-pending {
  background: #fff3e0;
  color: #e65100;
}

.badge-status-completed {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-discount {
  background: #f3e5f5;
  color: #6a1b9a;
}

.essay-state-badge,
.essay-status-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
}

.essay-state-none {
  background: #eeeeee;
  color: #666;
}

.essay-state-draft {
  background: #fff7d6;
  color: #8a6200;
}

.essay-state-submitted {
  background: #e8f5e9;
  color: #2e7d32;
}

.app-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-author {
  font-size: 13px;
  color: var(--sub);
  margin-bottom: 10px;
}

.app-meta {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.app-meta-row {
  font-size: 13px;
  color: var(--sub);
}

.app-meta-row strong {
  color: var(--text);
  font-weight: 700;
}

.app-requirement {
  font-size: 13px;
  color: var(--sub);
  margin-bottom: 14px;
  padding: 8px 12px;
  background: #f8f4e9;
  border-radius: 8px;
}

.app-requirement strong {
  color: var(--millie-deep);
}

.app-rejection {
  font-size: 13px;
  color: #c62828;
  background: #fff3f3;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.app-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.app-actions .btn-primary,
.app-actions .btn-line,
.btn-disabled,
.btn-completed {
  padding: 8px 20px;
  font-size: 13px;
}

.btn-disabled,
.btn-completed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border-radius: 999px;
  border: none;
  cursor: default;
}

.btn-disabled {
  background: #f0ebe3;
  color: var(--muted);
}

.btn-completed {
  font-weight: 800;
  background: #e8f5e9;
  color: #2e7d32;
}

.btn-millie-reader {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 999px;
  border: none;
  background: var(--millie-deep);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity .15s;
}

.btn-millie-reader::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z'/%3E%3Cpath d='M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.btn-millie-reader:hover {
  opacity: .85;
}

.learning-overview-actions {
  padding-top: 4px;
}

/* Essay modal */
#essay-modal {
  display: none;
}

.essay-modal {
  background: #fff;
  border-radius: 18px;
  padding: 36px 32px 28px;
  width: 560px;
  max-width: 96vw;
  box-shadow: 0 24px 60px rgba(31, 26, 22, .18);
}

.essay-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.essay-modal-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--millie-deep);
  margin-bottom: 0;
}

.essay-modal-book {
  font-size: 14px;
  color: var(--sub);
  margin-bottom: 16px;
}

.essay-textarea {
  width: 100%;
  border: 1.5px solid #e0d8cc;
  border-radius: 10px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  font-family: inherit;
  color: var(--text);
  box-sizing: border-box;
}

.essay-textarea:focus {
  outline: none;
  border-color: var(--millie-deep);
}

.essay-textarea[readonly] {
  background: #f7f3ec;
  color: var(--sub);
  cursor: default;
}

.essay-char-count {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  margin-bottom: 20px;
  text-align: right;
}

.essay-char-count.valid {
  color: #2e7d32;
}

.essay-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.learning-toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%) translateY(12px);
  z-index: 1000;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--millie-deep);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(31, 26, 22, .18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.learning-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 780px) {
  .mypage-sub-shell {
    display: block;
    padding: 0;
  }

  .mypage-sub-aside .sidebar-block {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }

  .mypage-sub-aside .lnb-list {
    margin-top: 6px;
  }

  .learning-wrap {
    padding-top: 6px;
  }

  .learning-page {
    padding-top: 150px;
  }

  .learning-filter {
    padding: 18px;
  }

  .learning-summary-head,
  .learning-card-head,
  .learning-posts-head {
    flex-direction: column;
  }

  .learning-overview-grid {
    grid-template-columns: 1fr;
  }

  .sort-label {
    margin-left: 0;
  }

  .filter-select {
    width: 100%;
  }

  .app-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
    padding: 20px 0;
  }

  .app-cover {
    width: 72px;
  }

  .app-title {
    white-space: normal;
  }

  .essay-modal {
    padding: 28px 20px 22px;
  }

  .essay-modal-actions {
    flex-direction: column-reverse;
  }
}

/* ===== 학사관리 3탭 ===== */
.learning-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border, #ebebeb);
  margin-bottom: 4px;
}

.learning-tab {
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 700;
  color: var(--sub, #888);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.learning-tab.active {
  color: var(--millie-deep, #4f2dde);
  border-bottom-color: var(--millie-deep, #4f2dde);
}

@media (max-width: 768px) {
  .learning-tab {
    flex: 1;
    padding: 10px 8px;
    font-size: 14px;
    text-align: center;
  }
}

/* 학습중 현재 차수 헤더 */
.learning-active-header {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--millie-deep, #4f2dde);
  background: var(--millie-light, #f3f0ff);
}

/* 신청과정 상태 뱃지 */
.badge-process-delivery {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: #fff3e0;
  color: #e65100;
}

.badge-process-setup {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: #fce4ec;
  color: #c62828;
}

/* 취소 버튼 */
.btn-cancel {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  color: var(--sub, #888);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-cancel:hover {
  border-color: #c62828;
  color: #c62828;
}

/* 학습완료 차수별/월별 섹션 헤더 */
.completed-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--sub, #888);
  border-bottom: 1px solid var(--border, #ebebeb);
  margin-top: 16px;
}

.completed-group-header:first-child {
  margin-top: 0;
}

.completed-group-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border, #ebebeb);
}
