/* ============================================================
   Personalization Side Panel (Dark Theme)
   ============================================================ */

:root {
  --pers-primary: #ff5d1a;
  --pers-primary-hover: #e04e10;
  --pers-bg-main: #504949; /* 패널 기본 배경 */
  --pers-bg-card: #3D3838; /* 항목 카드 배경 */
  --pers-bg-hover: #635f5d;
  --pers-bg-tab: #585252; /* 선택 안된 탭 / 프로필 영역 */
  --pers-bg-tab-active: #3a3837;
  --pers-border: #635f5d;
  --pers-text-primary: #ffffff;
  --pers-text-secondary: #dcdcdc;
  --pers-text-tertiary: #a8a8a8;
  --pers-shadow-card: 0 4px 12px rgba(0,0,0,0.2);
  --pers-radius-card: 8px;
}

/* ----- 토글 버튼 (닫힌 상태 — 프로필 영역 높이 고정) ----- */
.pers-toggle-btn {
  position: fixed;
  top: 90px;
  right: 0;
  z-index: 8500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 24px;
  height: 95px;
  background: #3a3837;
  color: #fff;
  border: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.pers-toggle-btn:hover { background: var(--pers-bg-hover); }
.pers-toggle-btn svg { width: 20px; height: 20px; stroke: #fff; flex-shrink: 0; }
.pers-toggle-label { font-size: 10px; font-weight: 700; color: #fff; letter-spacing: 0.06em; line-height: 1; }

/* ----- 배경 오버레이 ----- */
.pers-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 8600; }
.pers-overlay.is-open { display: block; }

/* ----- 슬라이딩 패널 ----- */
.pers-panel {
  position: fixed;
  top: 0;
  right: -500px;
  width: 480px;
  height: 100vh;
  background: var(--pers-bg-main);
  z-index: 8700;
  display: flex;
  flex-direction: column;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
  transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
  color: var(--pers-text-primary);
}
.pers-panel.is-open { right: 0; }

/* ----- 패널 왼쪽 닫기 탭 (열린 상태 — 프로필 영역 높이 고정) ----- */
.pers-panel-left-tab {
  position: absolute;
  top: 90px;
  left: -24px;
  width: 24px;
  height: 95px;
  background: #3a3837;
  border: none;
  border-radius: 8px 0 0 8px;
  color: var(--pers-primary);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.pers-panel-left-tab:hover { background: var(--pers-bg-hover); }
.pers-panel:not(.is-open) .pers-panel-left-tab { display: none; }

/* ----- 패널 본문 스크롤 영역 ----- */
.pers-panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 24px 20px;
  min-height: 0;
}

/* ----- 패널 헤더 (타이틀 영역) ----- */
.pers-header-title {
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 20px;
}
.pers-header-title .highlight { color: var(--pers-primary); }
.pers-header-title .normal { color: #fff; }
.pers-header-title .sub { font-size: 18px; font-weight: 400; color: var(--pers-text-tertiary); margin-left: 4px; }

/* 닫기 버튼 */
.pers-panel-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--pers-text-tertiary);
  font-size: 31px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s;
}
.pers-panel-close:hover { color: #fff; }

/* ----- 프로필 카드 ----- */
.pers-profile-card {
  background: var(--pers-bg-tab);
  border-radius: var(--pers-radius-card);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  position: relative;
}

.pers-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pers-avatar svg { width: 36px; height: 36px; fill: #aaa; }

.pers-profile-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pers-name-row { display: flex; align-items: baseline; gap: 6px; }
.pers-name { font-size: 24px; font-weight: 700; color: #fff; }
.pers-job-title { font-size: 18px; color: var(--pers-text-secondary); }
.pers-company { font-size: 17px; color: var(--pers-text-tertiary); }

.pers-contact-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}
.pers-contact-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  color: var(--pers-text-secondary);
}
.pers-contact-item svg { width: 12px; height: 12px; stroke: var(--pers-primary); fill: none; }

.pers-profile-settings {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--pers-text-tertiary);
  cursor: pointer;
  text-decoration: none;
  display: flex;
}
.pers-profile-settings svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
.pers-profile-settings:hover { color: #fff; }

/* ----- 알림 박스 ----- */
.pers-alert-box {
  background: var(--pers-bg-card);
  border-radius: var(--pers-radius-card);
  margin-bottom: 20px;
  height: 190px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.pers-alert-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pers-alert-header svg { width: 16px; height: 16px; stroke: var(--pers-primary); fill: none; }
.pers-alert-title { font-size: 18px; font-weight: 700; color: #fff; flex: 1; }
.pers-alert-badge {
  background: var(--pers-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pers-alert-list {
  padding: 12px 16px 12px 26px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
}
.pers-alert-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--pers-text-tertiary);
}
.pers-alert-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  color: var(--pers-text-secondary);
  cursor: pointer;
  transition: color 0.15s;
}
.pers-alert-item:hover { color: #fff; }
.pers-alert-item.is-read { opacity: 0.45; }
.pers-alert-item.is-expanded { align-items: flex-start; }
.pers-alert-bullet { color: var(--pers-primary); font-weight: bold; }
.pers-alert-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--pers-primary); flex-shrink: 0;
}
.pers-alert-item.is-expanded .pers-alert-dot { margin-top: 5px; }
.pers-alert-item.is-read .pers-alert-dot { background: #9C27B0; }
.pers-alert-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pers-alert-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pers-alert-item.is-expanded .pers-alert-text { white-space: normal; overflow: visible; }
.pers-alert-detail { display: none; }
.pers-alert-item.is-expanded .pers-alert-detail { display: flex; flex-direction: column; gap: 4px; }
.pers-alert-date { font-size: 14px; color: var(--pers-text-tertiary); }
.pers-alert-chevron {
  font-size: 24px; color: var(--pers-text-tertiary); flex-shrink: 0;
  transition: transform 0.2s; line-height: 1;
}
.pers-alert-item.is-expanded .pers-alert-chevron { transform: rotate(90deg); }
.pers-alert-link-btn {
  background: none; border: none; border-radius: 4px;
  color: var(--pers-text-tertiary); font-size: 14px; cursor: pointer;
  padding: 2px 6px; align-self: flex-start;
}
.pers-alert-link-btn:hover { color: var(--pers-primary); }
.pers-alert-delete-btn {
  margin-left: auto; background: none; border: none;
  border-radius: 4px; color: var(--pers-text-tertiary); font-size: 14px;
  cursor: pointer; padding: 2px 8px; white-space: nowrap;
}
.pers-alert-delete-btn:hover { color: var(--pers-primary); }
.pers-alert-close { cursor: pointer; color: var(--pers-text-tertiary); font-size: 18px; line-height: 1; flex-shrink: 0; }
.pers-alert-close:hover { color: #fff; }

/* ----- 탭 버튼 그룹 ----- */
.pers-tab-group {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.pers-tab-btn {
  flex: 1;
  background: var(--pers-bg-tab);
  border: none;
  border-radius: var(--pers-radius-card);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--pers-text-tertiary);
  position: relative;
}
.pers-tab-btn svg { width: 27px; height: 27px; flex-shrink: 0; }
.pers-tab-btn span { font-size: 16px; font-weight: 600; white-space: nowrap; }
.pers-tab-btn:hover { background: var(--pers-bg-hover); color: #fff; }
.pers-tab-btn.is-active {
  background: var(--pers-bg-tab-active);
  color: #fff;
}
.pers-tab-btn .badge {
  position: absolute;
  top: 8px;
  right: 12px;
  background: var(--pers-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ----- 탭 콘텐츠 영역 ----- */
.pers-tab-content-box {
  background: var(--pers-bg-card);
  border-radius: var(--pers-radius-card);
  padding: 20px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.pers-tab-content-box::-webkit-scrollbar { width: 4px; }
.pers-tab-content-box::-webkit-scrollbar-thumb { background: var(--pers-border); border-radius: 4px; }
.pers-tab-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.pers-tab-title-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.pers-tab-more-link {
  font-size: 16px;
  font-weight: 600;
  color: var(--pers-primary);
  text-decoration: none;
  white-space: nowrap;
}
.pers-tab-more-link:hover { text-decoration: underline; }
.pers-read-all-btn {
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--pers-text-tertiary);
  font-size: 14px;
  padding: 2px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s;
}
.pers-read-all-btn:hover {
  color: #fff;
}

/* ----- 리스트 아이템 ----- */
.pers-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  cursor: pointer;
  transition: opacity 0.2s;
}
.pers-list-item:hover { opacity: 0.8; }
.pers-list-date { font-size: 14px; color: var(--pers-text-tertiary); width: 85px; flex-shrink: 0; }
.pers-list-item .pers-list-date:last-child { text-align: right; }

/* 내가 쓴 글 / 댓글알림 3-컬럼 레이아웃 */
.pers-list-col-date {
  width: 54px;
  flex-shrink: 0;
  text-align: center;
  font-size: 13px;
  color: var(--pers-text-tertiary);
  line-height: 1.4;
}
.pers-list-col-cat {
  width: 46px;
  flex-shrink: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--pers-primary);
}
.pers-list-col-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  color: var(--pers-text-secondary);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pers-list-icon { width: 14px; height: 14px; stroke: var(--pers-text-tertiary); fill: none; margin-top: 2px; flex-shrink: 0; }
.pers-list-text {
  flex: 1;
  font-size: 17px;
  color: var(--pers-text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pers-list-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--pers-primary);
  flex-shrink: 0;
  margin-left: 8px;
}

/* 읽음 상태 */
.pers-list-item.is-read {
  opacity: 0.45;
  cursor: default;
}
.pers-list-item.is-read:hover { opacity: 0.45; }

/* 읽음 처리 X 버튼 */
.pers-notif-read-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--pers-text-tertiary);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.pers-list-item:hover .pers-notif-read-btn { opacity: 1; }
.pers-list-item.is-read .pers-notif-read-btn { display: none; }
.pers-notif-read-btn:hover { color: #fff; }

.pers-empty {
  font-size: 17px;
  color: var(--pers-text-tertiary);
  padding: 20px 0;
  text-align: center;
}

/* 로딩 스피너 등 기타 요소들 호환성 유지 */
.pers-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 20px; color: #aaa; font-size: 17px; }
.pers-spinner { width: 28px; height: 28px; border: 3px solid var(--pers-border); border-top-color: var(--pers-primary); border-radius: 50%; animation: persSpin 0.7s linear infinite; }
@keyframes persSpin { to { transform: rotate(360deg); } }

/* 즐겨찾기 서치/목록 호환성을 위한 일부 스타일 */
.pers-bm-tabs { display: flex; margin-bottom: 12px; }
.pers-bm-tab { flex: 1; background: none; border: none; padding: 8px; color: var(--pers-text-tertiary); cursor: pointer; }
.pers-bm-tab.is-active { color: var(--pers-primary); }
.pers-bm-search { width: 100%; padding: 8px 12px; background: var(--pers-bg-main); border: none; color: #fff; border-radius: 4px; margin-bottom: 12px; }
.pers-bm-type-badge {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 4px;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.pers-bm-type-badge.bm-standard { background: var(--pers-primary); color: #fff; }
.pers-bm-type-badge.bm-sector   { background: #2196F3; color: #fff; }
.pers-bm-type-badge.bm-special  { background: #9C27B0; color: #fff; }

/* Pill (최근검색용) */
.pers-pill-scroll { display: flex; flex-wrap: wrap; gap: 8px; }
.pers-pill { background: var(--pers-bg-main); border: 1px solid var(--pers-border); color: var(--pers-text-secondary); padding: 6px 12px; border-radius: 20px; cursor: pointer; font-size: 16px; }
.pers-pill:hover { border-color: var(--pers-primary); color: var(--pers-primary); }

/* 메모 등 다른 서브 요소 처리 */
.pers-memo-full-btn { display: block; text-align: center; color: var(--pers-primary); background: transparent; border: none; border-radius: 4px; padding: 8px; margin-top: 12px; text-decoration: none; font-size: 17px; }
.pers-memo-full-btn:hover { background: var(--pers-primary); color: #fff; }
.pers-memo-write-fab {
  position: absolute;
  bottom: 38px;
  right: 30px;
  display: flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  background: #534D4D; color: #FF5D1A;
  border: none; border-radius: 5px;
  font-size: 17px; font-weight: 700; cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  z-index: 10;
}
.pers-memo-write-fab:hover { background: #635e5e; transform: translateY(-2px); }
.pers-memo-write-fab svg { width: 13px; height: 13px; stroke: #FF5D1A; fill: none; flex-shrink: 0; }

.g-fab-wrap.pers-panel-open { z-index: 8400; }


/* ===== 메모 모달 ===== */
.pers-memo-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--pers-bg-main);
  z-index: 10;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.pers-memo-modal.is-open {
  transform: translateX(0);
}
.pers-memo-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
}
.pers-memo-back {
  background: none;
  border: none;
  color: var(--pers-text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pers-memo-back:hover {
  color: var(--pers-text-primary);
}
.pers-memo-modal-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}
.pers-memo-type-badge {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(255, 93, 26, 0.15);
  color: var(--pers-primary);
  border-radius: 4px;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
}
.pers-memo-modal-title {
  font-size: 26px;
  font-weight: 600;
  color: var(--pers-text-primary);
  margin-bottom: 12px;
  line-height: 1.4;
}
.pers-memo-modal-meta {
  font-size: 17px;
  color: var(--pers-text-secondary);
  margin-bottom: 24px;
}
.pers-memo-modal-content {
  font-size: 20px;
  color: var(--pers-text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}
.pers-memo-modal-footer {
  padding: 20px 24px;
  display: flex;
  gap: 12px;
}
.pers-memo-btn {
  flex: 1;
  padding: 12px;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.05);
  color: var(--pers-text-primary);
  border: none;
}
.pers-memo-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.pers-memo-btn-primary {
  background: var(--pers-primary);
  color: white;
  border: none;
}
.pers-memo-btn-primary:hover {
  background: #e55013;
}

/* ================================================================
   반응형: Mobile (≤ 767px)
   ================================================================ */
@media (max-width: 767px) {
  /* 패널 전체 너비를 화면에 맞춤 */
  .pers-panel {
    width: 100vw;
    right: -100vw;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
  .pers-panel.is-open { right: 0; }

  /* 패널 본문 여백 축소 */
  .pers-panel-body { padding: 16px 14px; }

  /* 헤더 타이틀 */
  .pers-header-title { font-size: 20px; margin-bottom: 12px; }
  .pers-header-title .sub { font-size: 14px; }

  /* 프로필 카드 */
  .pers-profile-card { padding: 12px; gap: 10px; margin-bottom: 14px; }
  .pers-avatar { width: 48px; height: 48px; }
  .pers-avatar svg { width: 26px; height: 26px; }
  .pers-name { font-size: 18px; }
  .pers-job-title { font-size: 14px; }
  .pers-company { font-size: 13px; }
  .pers-contact-item { font-size: 13px; }

  /* 알림 박스 */
  .pers-alert-box { height: 150px; margin-bottom: 14px; }
  .pers-alert-title { font-size: 15px; }
  .pers-alert-item { font-size: 14px; }
  .pers-alert-list { padding: 8px 12px 8px 18px; gap: 6px; }

  /* 탭 버튼 */
  .pers-tab-group { gap: 5px; margin-bottom: 14px; }
  .pers-tab-btn { padding: 10px 2px; gap: 4px; }
  .pers-tab-btn svg { width: 20px; height: 20px; }
  .pers-tab-btn span { font-size: 11px; }
  .pers-tab-btn .badge { font-size: 11px; top: 5px; right: 5px; }

  /* 탭 콘텐츠 */
  .pers-tab-content-box { padding: 12px; }
  .pers-tab-title { font-size: 16px; padding-bottom: 10px; margin-bottom: 10px; }
  .pers-tab-more-link { font-size: 14px; }

  /* 리스트 아이템 */
  .pers-list-text { font-size: 14px; }
  .pers-list-date { font-size: 12px; width: 70px; }
  .pers-list-col-date { font-size: 12px; width: 44px; }
  .pers-list-col-cat { font-size: 12px; width: 38px; }
  .pers-list-col-title { font-size: 13px; }
  .pers-empty { font-size: 14px; padding: 14px 0; }

  /* 메모 작성 FAB */
  .pers-memo-write-fab { font-size: 14px; padding: 8px 14px; bottom: 20px; right: 14px; }

  /* 메모 서브패널 */
  .pers-memo-modal-header { padding: 14px 16px; }
  .pers-memo-modal-body { padding: 16px; }
  .pers-memo-modal-title { font-size: 20px; }
  .pers-memo-modal-content { font-size: 15px; padding: 14px; }
  .pers-memo-modal-footer { padding: 14px 16px; gap: 10px; }
  .pers-memo-btn { font-size: 15px; padding: 10px; }
}
