/* ═══════════════════════════════════════════════════════════════
   AI Link 마이페이지 공통 스타일 — mypage.css v1
   al2- 디자인 시스템 기반 (ailink-ds.css 위에 로드)
   sales.html / manufacturer.html / customer.html 공통
   ═══════════════════════════════════════════════════════════════ */


/* ─── 1. 마이페이지 전용 섹션 전환 ─── */
.al2-mp-section { display: none; }
.al2-mp-section.on { display: block; animation: al2mp-fadein .25s ease; }
@keyframes al2mp-fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }


/* ─── 2. 대시보드 KPI 그리드 ─── */
.al2-mp-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .al2-mp-kpi { grid-template-columns: repeat(2, 1fr); } }


/* ─── 3. 프로필 카드 (사이드바 상단) ─── */
.al2-mp-profile {
  padding: 14px;
  border-bottom: 1px solid var(--al2-g100);
}

.al2-mp-profile-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.al2-mp-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--al2-radius-sm);
  background: linear-gradient(135deg, var(--al2-brand), #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.al2-mp-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.al2-mp-avatar .vf {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 13px;
  height: 13px;
  background: var(--al2-green);
  border-radius: 50%;
  border: 2px solid var(--al2-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6px;
  color: #fff;
}

.al2-mp-pinfo { flex: 1; min-width: 0; }

.al2-mp-pname {
  font-size: .82rem;
  font-weight: 700;
  color: var(--al2-g900);
  display: flex;
  align-items: center;
  gap: 5px;
}

.al2-mp-pname .role {
  font-size: .58rem;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
}
.al2-mp-pname .role.sales { background: var(--al2-amber-light); color: var(--al2-amber); }
.al2-mp-pname .role.mfr { background: var(--al2-blue-light); color: var(--al2-blue); }
.al2-mp-pname .role.cust { background: var(--al2-green-light); color: var(--al2-green); }

.al2-mp-pco {
  font-size: .7rem;
  color: var(--al2-g400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 프로필 완성도 미니바 */
.al2-mp-comp {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--al2-g50);
  border-radius: var(--al2-radius-sm);
}

.al2-mp-comp-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.al2-mp-comp-lbl { font-size: .62rem; color: var(--al2-g400); }
.al2-mp-comp-pct { font-size: .68rem; font-weight: 700; color: var(--al2-brand); font-family: var(--al2-font-mono); }
.al2-mp-comp-track { height: 3px; background: var(--al2-g200); border-radius: 2px; overflow: hidden; }
.al2-mp-comp-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--al2-brand), #a78bfa); transition: width .6s ease; }


/* ─── 4. 카드 컴포넌트 ─── */
.al2-mp-card {
  background: var(--al2-white);
  border: 1px solid var(--al2-g200);
  border-radius: var(--al2-radius-lg);
  overflow: hidden;
  margin-bottom: 14px;
}

.al2-mp-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--al2-g100);
}

.al2-mp-card-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--al2-g900);
  display: flex;
  align-items: center;
  gap: 7px;
}

.al2-mp-card-badge {
  font-size: .62rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--al2-radius-full);
  background: var(--al2-brand-light);
  color: var(--al2-brand);
}

.al2-mp-card-body { padding: 18px; }


/* ─── 5. 폼 요소 ─── */
.al2-mp-form-group { margin-bottom: 16px; }

.al2-mp-form-group label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--al2-g700);
  margin-bottom: 5px;
}

.al2-mp-form-group label .req { color: var(--al2-red); margin-left: 2px; }
.al2-mp-form-group label .opt { font-size: .68rem; font-weight: 400; color: var(--al2-g400); margin-left: 4px; }

.al2-mp-input,
.al2-mp-select,
.al2-mp-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--al2-g200);
  border-radius: var(--al2-radius-sm);
  font-family: var(--al2-font-sans);
  font-size: .82rem;
  color: var(--al2-g800);
  background: var(--al2-white);
  outline: none;
  transition: all .15s;
}

.al2-mp-input:focus,
.al2-mp-select:focus,
.al2-mp-textarea:focus {
  border-color: var(--al2-brand);
  box-shadow: 0 0 0 3px rgba(108,58,224,.08);
}

.al2-mp-textarea { resize: vertical; min-height: 80px; }

.al2-mp-hint {
  font-size: .7rem;
  color: var(--al2-g400);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.al2-mp-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 600px) { .al2-mp-form-row { grid-template-columns: 1fr; } }

.al2-mp-form-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
}


/* ─── 6. 버튼 ─── */
.al2-mp-btn {
  padding: 8px 16px;
  border-radius: var(--al2-radius-sm);
  font-size: .78rem;
  font-weight: 600;
  border: none;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.al2-mp-btn.pri { background: var(--al2-brand); color: #fff; }
.al2-mp-btn.pri:hover { background: var(--al2-brand-dark); }
.al2-mp-btn.sec { background: var(--al2-g100); color: var(--al2-g700); }
.al2-mp-btn.sec:hover { background: var(--al2-g200); }
.al2-mp-btn.outline { background: none; border: 1px solid var(--al2-g300); color: var(--al2-g700); }
.al2-mp-btn.outline:hover { border-color: var(--al2-g400); }
.al2-mp-btn.danger { background: var(--al2-red-light); color: var(--al2-red); }
.al2-mp-btn.danger:hover { background: var(--al2-red); color: #fff; }
.al2-mp-btn.sm { padding: 5px 10px; font-size: .72rem; }


/* ─── 7. 리스트 아이템 (문의함, 알림 등) ─── */
.al2-mp-list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--al2-g100);
  transition: background .1s;
  cursor: pointer;
}
.al2-mp-list-item:last-child { border-bottom: none; }
.al2-mp-list-item:hover { background: var(--al2-g50); }
.al2-mp-list-item.unread { background: rgba(108,58,224,.03); }

.al2-mp-list-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--al2-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  flex-shrink: 0;
}
.al2-mp-list-icon.blue  { background: var(--al2-blue-light);  color: var(--al2-blue); }
.al2-mp-list-icon.green { background: var(--al2-green-light); color: var(--al2-green); }
.al2-mp-list-icon.amber { background: var(--al2-amber-light); color: var(--al2-amber); }
.al2-mp-list-icon.brand { background: var(--al2-brand-light); color: var(--al2-brand); }
.al2-mp-list-icon.red   { background: var(--al2-red-light);   color: var(--al2-red); }
.al2-mp-list-icon.cyan  { background: var(--al2-cyan-light);  color: var(--al2-cyan); }

.al2-mp-list-body { flex: 1; min-width: 0; }
.al2-mp-list-title { font-size: .82rem; font-weight: 600; color: var(--al2-g800); }
.al2-mp-list-desc { font-size: .72rem; color: var(--al2-g500); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al2-mp-list-time { font-size: .65rem; color: var(--al2-g400); margin-top: 3px; font-family: var(--al2-font-mono); }

.al2-mp-list-status {
  font-size: .62rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--al2-radius-full);
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
}
.al2-mp-list-status.new { background: var(--al2-blue-light); color: var(--al2-blue); }
.al2-mp-list-status.pending { background: var(--al2-amber-light); color: var(--al2-amber); }
.al2-mp-list-status.done { background: var(--al2-green-light); color: var(--al2-green); }


/* ─── 8. 빈 상태 ─── */
.al2-mp-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--al2-g400);
}

.al2-mp-empty-icon { font-size: 2rem; margin-bottom: 10px; }
.al2-mp-empty h4 { font-size: .88rem; font-weight: 600; color: var(--al2-g600); margin-bottom: 4px; }
.al2-mp-empty p { font-size: .75rem; line-height: 1.5; }

.al2-mp-empty .al2-mp-btn { margin-top: 12px; }


/* ─── 9. 토글 스위치 ─── */
.al2-mp-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--al2-g100);
}
.al2-mp-toggle-row:last-child { border-bottom: none; }

.al2-mp-toggle-info { flex: 1; }
.al2-mp-toggle-lbl { font-size: .8rem; font-weight: 600; color: var(--al2-g700); }
.al2-mp-toggle-desc { font-size: .7rem; color: var(--al2-g400); margin-top: 2px; }

.al2-mp-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.al2-mp-switch input { opacity: 0; width: 0; height: 0; }

.al2-mp-switch .slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--al2-g300);
  border-radius: 10px;
  transition: background .2s;
  cursor: pointer;
}

.al2-mp-switch .slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background: var(--al2-white);
  border-radius: 50%;
  transition: transform .2s;
}

.al2-mp-switch input:checked + .slider { background: var(--al2-brand); }
.al2-mp-switch input:checked + .slider::before { transform: translateX(16px); }


/* ─── 10. 인증 그리드 ─── */
.al2-mp-cert-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 700px) { .al2-mp-cert-grid { grid-template-columns: 1fr; } }

.al2-mp-cert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: var(--al2-g50);
  border-radius: var(--al2-radius-md);
  border: 1px solid var(--al2-g100);
  transition: all .15s;
}
.al2-mp-cert-item.done { border-color: var(--al2-green); background: var(--al2-green-light); }

.al2-mp-cert-icon { font-size: 1.3rem; flex-shrink: 0; }
.al2-mp-cert-info { flex: 1; }
.al2-mp-cert-name { font-size: .78rem; font-weight: 600; color: var(--al2-g800); }
.al2-mp-cert-status { font-size: .68rem; color: var(--al2-g400); margin-top: 1px; }
.al2-mp-cert-pts { font-size: .68rem; font-weight: 600; color: var(--al2-brand); font-family: var(--al2-font-mono); }


/* ─── 11. 2열 레이아웃 ─── */
.al2-mp-g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 800px) { .al2-mp-g2 { grid-template-columns: 1fr; } }


/* ─── 12. 최근 활동 타임라인 ─── */
.al2-mp-timeline-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--al2-g100);
}
.al2-mp-timeline-item:last-child { border-bottom: none; }

.al2-mp-timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--al2-brand);
  margin-top: 5px;
  flex-shrink: 0;
}

.al2-mp-timeline-text { font-size: .78rem; color: var(--al2-g600); line-height: 1.5; }
.al2-mp-timeline-time { font-size: .65rem; color: var(--al2-g400); font-family: var(--al2-font-mono); margin-top: 2px; }


/* ─── 13. 위험 영역 (계정 삭제) ─── */
.al2-mp-danger-zone {
  border-color: var(--al2-red-light);
}

.al2-mp-danger-zone .al2-mp-card-hd {
  background: rgba(220,38,38,.03);
}

.al2-mp-danger-info { font-size: .78rem; color: var(--al2-g600); line-height: 1.6; margin-bottom: 14px; }


/* ─── 14. 칩 선택 (전문 분야, 고객군 등) ─── */
.al2-mp-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.al2-mp-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid var(--al2-g200);
  border-radius: var(--al2-radius-full);
  font-size: .75rem;
  font-weight: 500;
  color: var(--al2-g600);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}

.al2-mp-chip:hover { border-color: var(--al2-brand); color: var(--al2-brand); }

.al2-mp-chip input { display: none; }
.al2-mp-chip.on,
.al2-mp-chip:has(input:checked) {
  background: var(--al2-brand-light);
  border-color: var(--al2-brand);
  color: var(--al2-brand);
  font-weight: 700;
}


/* ─── 15. 스켈레톤 로딩 ─── */
@keyframes al2mp-shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.al2-mp-skel {
  background: linear-gradient(90deg, var(--al2-g100) 25%, var(--al2-g50) 50%, var(--al2-g100) 75%);
  background-size: 400px 100%;
  animation: al2mp-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--al2-radius-sm);
}

/* ─── 16. 탭 필터 ─── */
.al2-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.al2-tab {
  padding: 6px 14px;
  font-size: .75rem;
  font-weight: 600;
  border-radius: var(--al2-radius-full);
  border: 1px solid var(--al2-g200);
  background: none;
  color: var(--al2-g500);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.al2-tab:hover { border-color: var(--al2-brand); color: var(--al2-brand); }
.al2-tab.on {
  background: var(--al2-brand);
  color: #fff;
  border-color: var(--al2-brand);
}

/* ─── 17. 인증 카드 ─── */
.al2-mp-cert-grid { display: grid; gap: 8px; }
.al2-mp-cert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--al2-radius-sm);
  background: var(--al2-g50);
  transition: background .15s;
}
.al2-mp-cert-item:hover { background: var(--al2-g100); }
.al2-mp-cert-item.done { background: var(--al2-green-light); }
.al2-mp-cert-icon { font-size: 1rem; flex-shrink: 0; }
.al2-mp-cert-info { flex: 1; min-width: 0; }
.al2-mp-cert-name { font-size: .78rem; font-weight: 600; color: var(--al2-g700); }
.al2-mp-cert-status { font-size: .65rem; color: var(--al2-g400); margin-top: 1px; }
.al2-mp-cert-item.done .al2-mp-cert-status { color: var(--al2-green); }
.al2-mp-cert-pts { font-family: var(--al2-font-mono); font-size: .68rem; font-weight: 600; color: var(--al2-g400); flex-shrink: 0; }
.al2-mp-cert-item.done .al2-mp-cert-pts { color: var(--al2-green); }


/* ═══════════════════════════════════════════════════════════════
   18. 모바일 반응형
   ═══════════════════════════════════════════════════════════════ */

/* ─── 모바일 메뉴 토글 버튼 ─── */
.al2-mp-mobile-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--al2-brand);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(108,58,224,.35);
  z-index: 1100;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all .2s;
  align-items: center;
  justify-content: center;
}
.al2-mp-mobile-toggle:active { transform: scale(.92); }

/* ─── 900px: 태블릿 — 사이드바 아이콘 모드 ─── */
@media (max-width: 900px) {
  /* ailink-ds.css가 .al2-sb-profile 숨기지만 mypage는 .al2-mp-profile 사용 */
  .al2-mp-profile,
  .al2-mp-comp {
    display: none !important;
  }

  /* KPI 2열 */
  .al2-mp-kpi { grid-template-columns: repeat(2, 1fr); }
}

/* ─── 640px: 모바일 — 사이드바 오버레이 ─── */
@media (max-width: 640px) {
  /* 토글 버튼 표시 */
  .al2-mp-mobile-toggle { display: flex; }

  /* 사이드바: 화면 밖으로 숨김 → .open 시 오버레이 */
  .al2-sidebar {
    width: var(--al2-sidebar-w, 224px) !important;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 1050;
    box-shadow: none;
  }
  .al2-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(15,23,42,.12);
  }
  /* 사이드바 열릴 때 프로필 표시 */
  .al2-sidebar.open .al2-mp-profile,
  .al2-sidebar.open .al2-mp-comp,
  .al2-sidebar.open .al2-sb-section-label,
  .al2-sidebar.open .al2-badge,
  .al2-sidebar.open span {
    display: flex !important;
  }
  .al2-sidebar.open .al2-mp-comp { display: block !important; }
  .al2-sidebar.open .al2-sb-section-label { display: block !important; }

  /* 오버레이 배경 */
  .al2-mp-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.35);
    z-index: 1040;
  }
  .al2-mp-overlay.on { display: block; }

  /* 메인: 전체 폭 */
  .al2-main {
    margin-left: 0 !important;
    padding: 12px !important;
  }

  /* 히어로 카드: 세로 배치 */
  .al2-mp-card-body > div:first-child {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  /* 2열 → 1열 */
  .al2-mp-g2 { grid-template-columns: 1fr !important; }
  .al2-mp-form-row { grid-template-columns: 1fr !important; }

  /* KPI 2열 유지 */
  .al2-mp-kpi { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }

  /* 칩 그리드 */
  .al2-mp-chip-grid { gap: 4px; }
  .al2-mp-chip { font-size: .7rem; padding: 4px 10px; }

  /* 탭 필터 스크롤 */
  .al2-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .al2-tab { flex-shrink: 0; }

  /* 리스트 아이템 간소화 */
  .al2-mp-list-item { padding: 10px 12px; gap: 8px; }
  .al2-mp-list-icon { width: 28px; height: 28px; font-size: .75rem; }

  /* 카드 패딩 축소 */
  .al2-mp-card-hd { padding: 10px 14px; }
  .al2-mp-card-body { padding: 14px; }
  .al2-mp-card { margin-bottom: 10px; }

  /* 페이지 헤더 */
  .al2-page-header { flex-direction: column; gap: 8px; }
  .al2-page-header-actions { width: 100%; }
  .al2-page-header-actions a,
  .al2-page-header-actions button { width: 100%; text-align: center; }

  /* AEO 페이지 */
  .aeo-hero { flex-direction: column; text-align: center; }
  .aeo-cta { flex-direction: column; }
}
