/* public/assets/ui/framework/24_dropdowns.css
   KomodUI Dropdowns v0.1
   Header/user dropdown + generic dropdown menu styling.
   Bridges existing .header-user-dropdown .dropdown-menu markup.
*/

/* =========================
   Dropdown shell
   ========================= */

.header-user-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

/* Click/hover target */
.header-user-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  height: 40px;
  padding: 6px 10px;

  border-radius: 12px;
  text-decoration: none;
  color: var(--color-text, #111827);

  cursor: pointer;
  user-select: none;
}

.header-user-link:hover {
  background: rgba(0, 0, 0, .04);
}

.header-user-link:active {
  background: rgba(0, 0, 0, .06);
}

/* Avatar in header */
.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--color-border, #E5E7EB);
  background: var(--color-primary-soft, #EEF2FF);
  flex: 0 0 auto;
}

.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Username label */
.header-username {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.1;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================
   Dropdown menu panel
   ========================= */

.dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;

  min-width: 220px;
  max-width: min(320px, calc(100vw - 24px));

  background: var(--color-bg-white, #fff);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--shadow-lg, 0 20px 25px -5px rgba(0,0,0,.10), 0 10px 10px -5px rgba(0,0,0,.04));

  padding: 8px;
  z-index: var(--z-dropdown, 1100);

  display: none;
}

/* Default behavior: open on hover (bridge, no JS required) */
.header-user-dropdown:hover .dropdown-menu {
  display: block;
}

/* Also open if you later add .is-open via JS */
.header-user-dropdown.is-open .dropdown-menu {
  display: block;
}

/* =========================
   Menu items
   ========================= */

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px 10px;
  border-radius: 12px;

  color: var(--color-text, #111827);
  text-decoration: none;

  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;

  min-width: 0;
}

.dropdown-menu a i {
  font-size: 18px;
  color: var(--color-text-muted, #6B7280);
  flex: 0 0 auto;
}

.dropdown-menu a:hover {
  background: rgba(0, 0, 0, .04);
}

.dropdown-menu a:active {
  background: rgba(0, 0, 0, .06);
}

/* Divider */
.dropdown-divider {
  height: 1px;
  background: var(--color-border, #E5E7EB);
  margin: 8px 6px;
}

/* Danger link (logout) if inline-styled or later classed */
.dropdown-menu a[href="/logout"] {
  color: var(--color-danger, #EF4444);
}

.dropdown-menu a[href="/logout"] i {
  color: var(--color-danger, #EF4444);
}

/* =========================
   Accessibility helpers
   ========================= */

@media (prefers-reduced-motion: reduce) {
  .dropdown-menu {
    transition: none;
  }
}

/* =========================
   Mobile safety
   ========================= */

@media (max-width: 576px) {
  .header-username {
    display: none; /* save space on mobile */
  }

  .dropdown-menu {
    right: 0;
    left: auto;
  }
}  