/* ============================================================
   Account Picker – Google-style dropdown (standalone component)
   ============================================================
   Usage: Include this CSS + account-picker.js in any page.
   It will auto-inject into the navbar's .d-flex or
   #navbar-right-slot container.
   ============================================================ */

/* Avatar bubble */
.account-picker-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00509d, #00296b);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    user-select: none;
    flex-shrink: 0;
    position: relative;
}

.account-picker-avatar:hover {
    box-shadow: 0 0 0 3px rgba(0, 80, 157, 0.25);
    transform: scale(1.05);
}

/* Dropdown panel */
.account-picker-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 300px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 9999;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.account-picker-dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header in dropdown showing active email */
.account-picker-header {
    padding: 16px 16px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    text-align: center;
}

.account-picker-header-email {
    font-size: 0.85rem;
    color: #333;
    font-weight: 500;
    word-break: break-all;
}

.account-picker-header-label {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

/* Account rows */
.account-picker-list {
    padding: 6px 0;
    max-height: 220px;
    overflow-y: auto;
}

.account-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.account-picker-item:hover {
    background: rgba(0, 80, 157, 0.06);
}

.account-picker-item.active {
    background: rgba(0, 80, 157, 0.08);
}

.account-picker-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.account-picker-item.active .account-picker-item-avatar {
    background: linear-gradient(135deg, #00509d, #00296b);
}

.account-picker-item-info {
    flex: 1;
    min-width: 0;
}

.account-picker-item-email {
    font-size: 0.82rem;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-picker-item-active-badge {
    font-size: 0.65rem;
    color: #00509d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.account-picker-item-check {
    color: #00509d;
    font-size: 0.85rem;
}

/* Action buttons (Add account, Sign out) */
.account-picker-actions {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 6px 0;
}

.account-picker-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.82rem;
    color: #555;
    text-decoration: none;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
}

.account-picker-action:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #333;
}

.account-picker-action i {
    width: 18px;
    text-align: center;
    font-size: 0.85rem;
    color: #888;
}

/* Wrapper for positioning */
.account-picker-wrapper {
    position: relative;
    display: inline-flex;
    margin-top: 2px;
}

/* The trigger is centered inside the expanded hamburger on phones, so pin
   the dropdown to the navbar instead of anchoring to the trigger */
@media (max-width: 480px) {
  .account-picker-dropdown {
    position: fixed;
    left: 10px;
    right: 10px;
    width: auto;
    top: 80px;
  }
}
/* iOS/Android minimum touch-target size on mobile (parity with auth's 44px) */
@media (max-width: 767.98px) {
  .account-picker-avatar {
    width: 44px;
    height: 44px;
  }
}

/* Sign-in affordance shown when /api/accounts returns 401 (no session on this device) */
.account-picker-signin {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff !important;
    background: linear-gradient(135deg, #00509d, #00296b);
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.account-picker-signin:hover {
    opacity: 0.85;
    color: #fff;
}

@media (max-width: 991.98px) {
    .account-picker-signin {
        min-height: 44px;
        padding: 10px 18px;
    }
}
