/* user-dropdown.css */

/* ── Avatar state — works on both .user-btn and .header-user-btn ────────────── */
.user-btn--avatar {
  padding: 0 !important;
  overflow: hidden;
  border-radius: 50% !important;
  /* border glows cyan to signal logged-in state */
  border: 2px solid rgba(34, 211, 238, 0.5) !important;
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.2);
  width: 36px;
  height: 36px;
}

.user-btn--avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* Initial letter shown when user has no profile picture */
.user-btn__initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.78rem;
  font-weight: 700;
  color: #22d3ee;
  background: rgba(34, 211, 238, 0.12);
  border-radius: 50%;
  line-height: 1;
}

/* ── Dropdown panel ──────────────────────────────────────────────────────────── */
.user-dropdown {
  display: none;
  position: fixed; /* body-level, positioned by JS via getBoundingClientRect */
  min-width: 210px;
  background: #1a1d28;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 0.4rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  z-index: 200;
}

.user-dropdown.open {
  display: block;
  animation: dropdown-in 0.15s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── Info block ──────────────────────────────────────────────────────────────── */
.user-dropdown-info {
  display: flex;
  flex-direction: column;
  gap: 0.1em;
  padding: 0.55rem 0.8rem 0.6rem;
}

.user-dropdown-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e8eaf0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-email {
  font-size: 0.73rem;
  color: rgba(232,234,240,0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Divider ─────────────────────────────────────────────────────────────────── */
.user-dropdown-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin: 0.25rem 0;
}

/* ── Menu items ──────────────────────────────────────────────────────────────── */
.user-dropdown-item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  font-size: 0.83rem;
  color: rgba(232,234,240,0.65);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  font-family: inherit;
}

.user-dropdown-item:hover {
  background: rgba(255,255,255,0.06);
  color: #e8eaf0;
}

#logout-btn:hover {
  background: rgba(239,68,68,0.08);
  color: #fca5a5;
}

/* ── Dropdown history section ────────────────────────────────────────────────── */
.user-dropdown-section-label {
  font-size: 0.65em;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232,234,240,0.25);
  padding: 0.5rem 1rem 0.3rem;
}

.user-dropdown-history {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.user-dropdown-history-loading,
.user-dropdown-history-empty {
  font-size: 0.75em;
  color: rgba(232,234,240,0.3);
  padding: 0.4rem 1rem 0.6rem;
}

.user-dropdown-history-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75em;
  padding: 0.45rem 1rem;
  text-decoration: none;
  border-radius: 6px;
  margin: 0 0.3rem;
  transition: background 0.12s ease;
}
.user-dropdown-history-item:hover {
  background: rgba(255,255,255,0.06);
}

.user-dropdown-history-title {
  font-size: 0.78em;
  color: rgba(232,234,240,0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.user-dropdown-history-time {
  font-size: 0.68em;
  color: rgba(232,234,240,0.28);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Make dropdown wider to fit history items */
.user-dropdown {
  min-width: 240px !important;
  max-width: 300px !important;
}

/* ── Home page recent conversations grid ─────────────────────────────────────── */
.home-history-section {
  width: 100%;
  max-width: 580px;
  margin: 2rem auto 0;
  animation: fadeInUp 0.35s ease both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.home-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.home-history-label {
  font-size: 0.68em;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232,234,240,0.28);
}

.home-history-view-all {
  font-size: 0.72em;
  color: rgba(34,211,238,0.6);
  text-decoration: none;
  transition: color 0.15s;
}
.home-history-view-all:hover { color: #22d3ee; }

.home-history-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.home-history-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem 0.9rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
  min-width: 0;
}
.home-history-card:hover {
  background: rgba(34,211,238,0.05);
  border-color: rgba(34,211,238,0.2);
}

.home-history-card-title {
  font-size: 0.8em;
  color: rgba(232,234,240,0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.home-history-card-time {
  font-size: 0.67em;
  color: rgba(232,234,240,0.28);
}

/* Single column on narrow screens */
@media (max-width: 480px) {
  .home-history-grid { grid-template-columns: 1fr; }
  .home-history-section { padding: 0 1rem; }
}
