﻿/* =============================================================================
   DangNhapTaiKhoan – User Menu  v3.0
   Single source of truth — matches PHP template HTML exactly.
   JS toggles .is-open on .dntk-um wrapper.
   ============================================================================= */

/* ── Box-sizing reset ───────────────────────────────────────────────────────── */
.dntk-um *,
.dntk-um-login-btn,
.dntk-um-hocngay-btn {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

/* ── Shared font ────────────────────────────────────────────────────────────── */
.dntk-um,
.dntk-um-login-btn,
.dntk-um-hocngay-btn {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   1. WRAPPER
   ═══════════════════════════════════════════════════════════════════════════════ */
.dntk-um {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   2. AVATAR TRIGGER BUTTON
   ═══════════════════════════════════════════════════════════════════════════════ */
.dntk-um__trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, #1d71ab, #2585c5);
  cursor: pointer;
  outline: none;
  overflow: visible;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(29, 113, 171, 0.28);
  transition: box-shadow 0.2s, transform 0.18s;
}
.dntk-um__trigger:hover {
  box-shadow: 0 0 0 3px rgba(29, 113, 171, 0.2), 0 4px 12px rgba(29, 113, 171, 0.26);
  transform: translateY(-1px);
}
.dntk-um__trigger:focus-visible {
  box-shadow: 0 0 0 3px rgba(29, 113, 171, 0.45);
}
.dntk-um.is-open .dntk-um__trigger,
.dntk-um__trigger[aria-expanded="true"] {
  box-shadow: 0 0 0 3px rgba(29, 113, 171, 0.26), 0 2px 8px rgba(29, 113, 171, 0.2);
  transform: scale(0.96);
}

/* Online dot */
.dntk-um__trigger::after {
  content: "";
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background: #22c55e;
  border: 2.5px solid #fff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
}

/* Inner circle clips avatar image */
.dntk-um__trigger-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dntk-um__avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.dntk-um__initials {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  line-height: 1;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   3. DROPDOWN PANEL
   ═══════════════════════════════════════════════════════════════════════════════ */
.dntk-um__dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 300px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 18px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.03),
    0 8px 16px -4px rgba(0, 0, 0, 0.08),
    0 24px 48px -8px rgba(0, 0, 0, 0.14);
  z-index: 99999;
  overflow: visible; /* must be visible so ::before caret shows */

  /* Hidden state */
  opacity: 0;
  transform: translateY(-10px) scale(0.96);
  transform-origin: top right;
  pointer-events: none;
  transition:
    opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* OPEN STATE — JS adds .is-open to .dntk-um wrapper */
.dntk-um.is-open .dntk-um__dropdown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Caret arrow */
.dntk-um__dropdown::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 15px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-left: 1px solid rgba(226, 232, 240, 0.8);
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 3px 0 0 0;
  transform: rotate(45deg);
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   4. USER IDENTITY CARD  (.dntk-um__card)
   ═══════════════════════════════════════════════════════════════════════════════ */
.dntk-um__card {
  padding: 20px 18px 16px;
  background: linear-gradient(160deg, #f0f4ff 0%, #f8faff 100%);
  border-radius: 17px 17px 0 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

/* Large square avatar inside card */
.dntk-um__card-avatar {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(145deg, #1d71ab, #2585c5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(29, 113, 171, 0.28);
}
.dntk-um__card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}
.dntk-um__card-avatar span {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
  user-select: none;
}

/* Text column */
.dntk-um__card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.dntk-um__card-site {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #1d71ab;
}
.dntk-um__card-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dntk-um__card-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dntk-um__card-meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #64748b;
}
.dntk-um__card-meta-row svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  stroke: #94a3b8;
}
.dntk-um__card-meta-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Role badge */
.dntk-um__role {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  align-self: flex-start;
}
.dntk-um__role--admin   { background: #e0f0ff; color: #1d71ab; }
.dntk-um__role--teacher { background: #f5f3ff; color: #7c3aed; }
.dntk-um__role--member  { background: #dcfce7; color: #16a34a; }

/* ═══════════════════════════════════════════════════════════════════════════════
   5. DIVIDER
   ═══════════════════════════════════════════════════════════════════════════════ */
.dntk-um__sep {
  height: 1px;
  background: #f1f5f9;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   6. NAV ITEMS
   ═══════════════════════════════════════════════════════════════════════════════ */
.dntk-um__nav {
  padding: 8px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.dntk-um__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 500;
  color: #1e293b;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
  outline: none;
}
.dntk-um__item:hover,
.dntk-um__item:focus-visible {
  background: #f5f7ff;
  color: #0f172a;
  text-decoration: none;
}
.dntk-um__item:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(29, 113, 171, 0.3);
}

/* Icon pill */
.dntk-um__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex-shrink: 0;
  transition: transform 0.16s;
}
.dntk-um__item:hover .dntk-um__icon {
  transform: scale(1.1);
}
.dntk-um__icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Icon color variants */
.dntk-um__icon--teal   { background: #f0fdfa; }
.dntk-um__icon--teal   svg { stroke: #0f9484; }
.dntk-um__icon--blue   { background: #eff6ff; }
.dntk-um__icon--blue   svg { stroke: #2563eb; }
.dntk-um__icon--orange { background: #fff7ed; }
.dntk-um__icon--orange svg { stroke: #ea580c; }
.dntk-um__icon--gray   { background: #f8fafc; }
.dntk-um__icon--gray   svg { stroke: #475569; }
.dntk-um__icon--red    { background: #fff5f5; }
.dntk-um__icon--red    svg { stroke: #dc2626; }

/* ═══════════════════════════════════════════════════════════════════════════════
   7. FOOTER / LOGOUT
   ═══════════════════════════════════════════════════════════════════════════════ */
.dntk-um__footer {
  padding: 4px 8px 10px;
  border-radius: 0 0 17px 17px;
  overflow: hidden;
}
.dntk-um__item--logout       { color: #ef4444; }
.dntk-um__item--logout:hover,
.dntk-um__item--logout:focus-visible {
  background: #fff1f2;
  color: #dc2626;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   8. GUEST LOGIN BUTTON
   ═══════════════════════════════════════════════════════════════════════════════ */
.dntk-um-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 22px 9px 18px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, #1d71ab 0%, #2585c5 100%);
  box-shadow: 0 1px 3px rgba(29, 113, 171, 0.22), 0 4px 12px rgba(29, 113, 171, 0.2);
  transition: box-shadow 0.18s, transform 0.15s, filter 0.18s;
  white-space: nowrap;
  outline: none;
  letter-spacing: 0.1px;
}
.dntk-um-login-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.dntk-um-login-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 16px rgba(29, 113, 171, 0.38);
  transform: translateY(-1px);
  color: #fff;
  text-decoration: none;
}
.dntk-um-login-btn:active      { transform: translateY(0); }
.dntk-um-login-btn:focus-visible { box-shadow: 0 0 0 3px rgba(29, 113, 171, 0.45); }

/* ═══════════════════════════════════════════════════════════════════════════════
   9. "VÀO HỌC" CTA BUTTON (standalone shortcode dùng ngoài dropdown)
   ═══════════════════════════════════════════════════════════════════════════════ */
.dntk-um-hocngay-btn {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 9px 22px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, #1d71ab 0%, #2585c5 100%);
  box-shadow: 0 1px 3px rgba(29, 113, 171, 0.22), 0 4px 12px rgba(29, 113, 171, 0.2);
  transition: box-shadow 0.18s, transform 0.15s, filter 0.18s;
  white-space: nowrap;
  outline: none;
  letter-spacing: 0.1px;
}
.dntk-um-hocngay-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 16px rgba(29, 113, 171, 0.38);
  transform: translateY(-1px);
  color: #fff;
  text-decoration: none;
}
.dntk-um-hocngay-btn:active      { transform: translateY(0); filter: none; }
.dntk-um-hocngay-btn:focus-visible { box-shadow: 0 0 0 3px rgba(29, 113, 171, 0.45); }

/* "Vào học" bên trong dropdown nav — giống hệt các item khác */
.dntk-um .dntk-um__nav .dntk-um__item:first-child,
.dntk-um .dntk-um__nav a.dntk-um__item:first-child {
  background: transparent !important;
  background-image: none !important;
  color: #1e293b !important;
  border-radius: 11px !important;
  padding: 9px 11px !important;
  box-shadow: none !important;
  border: none !important;
  width: auto !important;
  filter: none !important;
  transform: none !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  justify-content: flex-start !important;
  text-align: left !important;
}
.dntk-um .dntk-um__nav .dntk-um__item:first-child:hover,
.dntk-um .dntk-um__nav a.dntk-um__item:first-child:hover {
  background: #f5f7ff !important;
  color: #0f172a !important;
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   10. RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .dntk-um__dropdown {
    right: -6px;
    width: 280px;
  }
  .dntk-um__dropdown::before { right: 10px; }
}

/* Mobile: nút "Học ngay" — hiện trong flow trang, không đè lên slide */
@media (max-width: 768px) {
  .dntk-um-hocngay-btn {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: auto;
    display: flex;
    width: 100%;
    flex: 1;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    padding: 14px 16px;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(29, 113, 171, 0.32);
  }
  /* Tăng specificity (0,2,0) > (0,1,1) để thắng partner-btn.css: a[href*="pkh-my-courses"] { width: auto !important } */
  .col .dntk-um-hocngay-btn,
  .ux-col .dntk-um-hocngay-btn,
  .wp-block-column .dntk-um-hocngay-btn,
  .dntk-action-bar .dntk-um-hocngay-btn {
    display: flex !important;
    width: 100% !important;
    flex: 1 !important;
    justify-content: center !important;
  }

  /* Khi pkh-partner-btn và dntk-um-hocngay-btn nằm chung 1 Flatsome column,
     biến column đó thành flex row để 2 button chia đều nhau */
  .col:has(.pkh-partner-btn):has(.dntk-um-hocngay-btn),
  .ux-col:has(.pkh-partner-btn):has(.dntk-um-hocngay-btn),
  .wp-block-column:has(.pkh-partner-btn):has(.dntk-um-hocngay-btn) {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    align-items: stretch !important;
    padding: 10px 12px !important;
    box-sizing: border-box !important;
  }

  /* Khi chỉ có dntk-um-hocngay-btn (button đối tác bị ẩn) — căn giữa toàn chiều ngang */
  .col:has(.dntk-um-hocngay-btn):not(:has(.pkh-partner-btn)),
  .ux-col:has(.dntk-um-hocngay-btn):not(:has(.pkh-partner-btn)),
  .wp-block-column:has(.dntk-um-hocngay-btn):not(:has(.pkh-partner-btn)) {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 10px 12px !important;
    box-sizing: border-box !important;
  }
}
/* ═══════════════════════════════════════════════════════════════════════════════
   11. ACTION BAR — [dntk_action_bar] shortcode
   Full-width dedicated bar — NOT overlaying content, lives in normal page flow.
   Place this shortcode BELOW the header row, ABOVE the slide section.
   ═══════════════════════════════════════════════════════════════════════════════ */
.dntk-action-bar {
  display: none; /* Desktop: hidden — individual buttons in header nav handle desktop */
}

@media (max-width: 768px) {
  .dntk-action-bar {
    display: flex;
    width: 100%;
    gap: 10px;
    padding: 10px 12px;
    background: #ffffff;
    box-sizing: border-box;
  }

  /* "Vào học" button inside action bar */
  .dntk-action-bar .dntk-ab-hoc-btn {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 14px 10px !important;
    border-radius: 10px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #fff !important;
    text-decoration: none !important;
    background: linear-gradient(135deg, #1d71ab 0%, #2585c5 100%) !important;
    box-shadow: 0 4px 14px rgba(29, 113, 171, 0.32) !important;
    transition: filter 0.18s, transform 0.15s;
    white-space: nowrap !important;
    width: auto;
  }
  .dntk-action-bar .dntk-ab-hoc-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
  }

  /* Partner button inside action bar (overrides fixed-position rules) */
  .dntk-action-bar .dntk-ab-partner-btn,
  .dntk-action-bar .pkh-partner-btn {
    flex: 1 !important;
    justify-content: center !important;
    padding: 14px 10px !important;
    border-radius: 10px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%) !important;
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.32) !important;
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    z-index: auto !important;
  }
  .dntk-action-bar .dntk-ab-partner-btn:hover,
  .dntk-action-bar .pkh-partner-btn:hover {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%) !important;
    filter: none !important;
    transform: translateY(-1px) !important;
  }

  /* Single button variant — full width, centered */
  .dntk-action-bar--single {
    justify-content: center;
  }
  .dntk-action-bar--single .dntk-ab-hoc-btn {
    width: 100% !important;
    flex: 1 !important;
    display: flex !important;
  }
}
