/* Shared auth UI (button + dropdown panel), injected by auth.js on all
   three pages. Reader-specific placement of .auth-controls stays in
   styles.css; menu-header placement lives at the bottom of this file. */

.auth-button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: rgba(245, 245, 247, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    color: #667;
    transition: all 0.2s ease;
}

.auth-button:hover {
    background-color: rgba(230, 230, 235, 0.9);
    transform: scale(1.05);
}

.auth-button.logged-in {
    background-color: #1d1d1f;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Drops down, right-aligned so it never overflows the viewport */
.auth-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    background-color: rgba(245, 245, 247, 0.95);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 20;
}

.auth-panel.hidden {
    display: none;
}

#auth-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
}

#auth-form.hidden {
    display: none;
}

.auth-panel-title {
    font-size: 12px;
    font-weight: 500;
    color: #667;
}

.auth-panel input {
    padding: 6px 8px;
    font-size: 13px;
    font-family: inherit;
    color: #333;
    background-color: white;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    outline: none;
}

.auth-panel input:focus {
    border-color: #1d1d1f;
}

.auth-actions {
    display: flex;
    gap: 8px;
}

.auth-actions button,
#auth-logout {
    flex: 1;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    color: #333;
    background-color: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#auth-login {
    background-color: #1d1d1f;
    border-color: #1d1d1f;
    color: white;
}

.auth-actions button:hover,
#auth-logout:hover {
    transform: scale(1.03);
}

.auth-signed-in {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-signed-in.hidden {
    display: none;
}

.auth-email-label {
    font-size: 12px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-error {
    font-size: 12px;
    color: #c0392b;
}

.auth-notice {
    font-size: 12px;
    color: #667;
}

.auth-error.hidden,
.auth-notice.hidden {
    display: none;
}

/* Words known / Challenge words, shown while signed in */
.auth-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.auth-stats.hidden {
    display: none;
}

.auth-stat {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #333;
}

.auth-stat-value {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Account deletion (link + typed confirmation) */
.auth-delete-link {
    align-self: flex-start;
    padding: 0;
    font-size: 11px;
    font-family: inherit;
    color: #c0392b;
    background: none;
    border: none;
    cursor: pointer;
}

.auth-delete-link:hover {
    text-decoration: underline;
}

.auth-delete-confirm {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-delete-confirm.hidden {
    display: none;
}

.auth-delete-warning {
    font-size: 12px;
    color: #c0392b;
}

#auth-delete-danger {
    background-color: #c0392b;
    border-color: #c0392b;
    color: white;
}

#auth-delete-danger:disabled {
    opacity: 0.4;
    cursor: default;
}

#auth-delete-danger:disabled:hover {
    transform: none;
}

/* Menu headers (index.html, book.html): push the button to the right
   edge; position: relative anchors the absolute dropdown to the button
   (the reader's wrapper is itself absolute, so it already anchors) */
.header-row .auth-controls {
    margin-left: auto;
    position: relative;
}
