/* Task #413 — Eclipse Address Book Autocomplete styles.
 *
 * The component injects the same rules inline as a fallback (so the
 * widget still works on modal-only pages that don't include this
 * stylesheet), but loading this file globally lets us override modal-
 * specific tweaks (e.g. mobile-app full-screen z-index) in one place.
 */

.ab-wrap {
    position: relative;
}

.ab-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 4px;
    max-height: 320px;
    overflow-y: auto;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 8px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    z-index: 10100;
    font-size: 13px;
    color: #e5e7eb;
}

.ab-dropdown[hidden] { display: none; }

.ab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-bottom: 1px solid #374151;
    background: #111827;
    color: #9ca3af;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ab-refresh {
    background: transparent;
    border: 0;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
}

.ab-refresh:hover {
    color: #e5e7eb;
    background: #374151;
}

.ab-refresh[disabled] {
    opacity: 0.4;
    cursor: wait;
}

.ab-row {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(55, 65, 81, 0.5);
}

.ab-row:last-child { border-bottom: 0; }

.ab-row:hover,
.ab-row.ab-active {
    background: #374151;
}

/* Task #446 — per-row remove button (✕) for recent recipients. Hidden
   by default; revealed on row hover/focus so the search-result rows
   stay visually clean. */
.ab-recent-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    padding: 0;
    line-height: 1;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.12s, background 0.12s, color 0.12s;
}

.ab-row:hover .ab-recent-remove,
.ab-row.ab-active .ab-recent-remove,
.ab-recent-remove:focus {
    opacity: 1;
}

.ab-recent-remove:hover {
    background: #4b5563;
    color: #fca5a5;
}

/* Task #446 — dropdown footer with the "Clear recent" link. */
.ab-footer {
    display: flex;
    justify-content: flex-end;
    padding: 6px 10px;
    border-top: 1px solid #374151;
    background: #111827;
}

.ab-footer[hidden] { display: none; }

.ab-clear-recents {
    background: transparent;
    border: 0;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ab-clear-recents:hover {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
}

.ab-clear-recents[disabled] {
    opacity: 0.4;
    cursor: wait;
}

.ab-row-name {
    color: #f9fafb;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ab-row-meta {
    color: #9ca3af;
    font-size: 11px;
}

.ab-row-email {
    color: #93c5fd;
    font-size: 12px;
    word-break: break-all;
}

.ab-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 9999px;
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ab-tag.ab-tag-vendor {
    background: rgba(168, 85, 247, 0.18);
    color: #c4b5fd;
    border-color: rgba(168, 85, 247, 0.35);
}

.ab-empty,
.ab-loading {
    padding: 14px;
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
}

/* Task #536 — small inline note shown when the search endpoint returns
   `degraded: true` (Eclipse OData unreachable, cache DB blip, …). The
   dropdown still shows whatever cached rows we have; the note explains
   why live results aren't there. Replaces the old red HTTP 500 error. */
.ab-degraded-note {
    padding: 6px 10px;
    font-size: 11px;
    line-height: 1.35;
    color: #fcd34d;
    background: rgba(120, 53, 15, 0.35);
    border-bottom: 1px solid rgba(202, 138, 4, 0.35);
}

/* Task #433 — inline "save your Eclipse credentials" CTA shown when the
   address-book endpoint returns needsCredentials=true. */
.ab-creds-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 14px;
}
.ab-creds-gate-icon {
    font-size: 22px;
    line-height: 1;
}
.ab-creds-gate-text {
    color: #d1d5db;
    font-size: 12px;
    line-height: 1.4;
    max-width: 280px;
}
.ab-creds-gate-btn {
    background: #7c3aed;
    color: #fff;
    border: 0;
    cursor: pointer;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.ab-creds-gate-btn:hover {
    background: #6d28d9;
}
.ab-creds-gate-btn:focus {
    outline: 2px solid #a78bfa;
    outline-offset: 1px;
}

.ab-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #4b5563;
    border-top-color: #93c5fd;
    border-radius: 50%;
    animation: ab-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes ab-spin {
    to { transform: rotate(360deg); }
}
