/**
 * Version: 1.2.0
 */
/**
 * AstroUtah Authentication Styles
 * Dark theme to match the AstroUtah site design
 */

/* ============================================================================
   CSS VARIABLES
   ============================================================================ */

:root {
    --auth-bg-container:  #1a1a1f;
    --auth-bg-input:      #0f0f14;
    --auth-bg-input-focus:#fbbf24;
    --auth-border:        #374151;
    --auth-border-focus:  #60a5fa;
    --auth-text-primary:  #e5e7eb;
    --auth-text-secondary:#9ca3af;
    --auth-text-heading:  #ffffff;
    --auth-text-muted:    #6b7280;
    --auth-accent-blue:   #3b82f6;
    --auth-accent-green:  #10b981;
    --auth-accent-red:    #ef4444;
    --auth-accent-yellow: #f59e0b;
    --auth-link:          #60a5fa;
}

/* ============================================================================
   AUTH PAGE CONTAINERS
   ============================================================================ */

.astroutah-auth-page {
    max-width: 500px;
    margin: 40px auto;
    padding: 20px;
}

.auth-container {
    background: var(--auth-bg-container);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h2 {
    color: var(--auth-text-heading);
    margin-bottom: 8px;
    font-size: 28px;
}

.auth-subtitle {
    color: var(--auth-text-secondary);
    font-size: 14px;
    margin: 0;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--auth-border);
    font-size: 14px;
}

.auth-footer p {
    margin: 0;
    color: var(--auth-text-muted);
}

.auth-footer a {
    color: var(--auth-link);
    text-decoration: none;
    margin-left: 6px;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ============================================================================
   AUTH FORMS
   ============================================================================ */

.astroutah-auth-form {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--auth-text-primary);
    font-weight: 600;
    font-size: 14px;
}

.form-group .required {
    color: var(--auth-accent-red);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--auth-bg-input);
    border: 2px solid var(--auth-border);
    border-radius: 8px;
    color: var(--auth-text-primary);
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
    background: var(--auth-bg-input-focus);
    color: #111827;
}

.form-control::placeholder {
    color: var(--auth-text-muted);
}

/* Autofill override — browsers force white bg without this */
.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-text-primary);
    -webkit-box-shadow: 0 0 0px 1000px var(--auth-bg-input) inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Autofill when focused — match yellow focus theme */
.form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: #111827;
    -webkit-box-shadow: 0 0 0px 1000px #fbbf24 inset;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--auth-text-secondary);
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Checkboxes */
.form-check {
    display: flex;
    align-items: flex-start;
}

.form-check label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: 400;
    color: var(--auth-text-secondary);
}

.form-check input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 3px;
    cursor: pointer;
    accent-color: var(--auth-accent-blue);
}

.form-check a {
    color: var(--auth-link);
    text-decoration: none;
}

.form-check a:hover {
    text-decoration: underline;
}

/* Form Actions */
.form-actions {
    margin-top: 24px;
}

.form-links {
    text-align: center;
    margin-top: 16px;
}

.form-links a {
    color: var(--auth-link);
    text-decoration: none;
    font-size: 14px;
}

.form-links a:hover {
    text-decoration: underline;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    display: inline-block;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

/* Green for register — matches v2 Create Account button */
.astroutah-register-page .btn-primary {
    background: var(--auth-accent-green);
    color: #ffffff;
    width: 100%;
}

.astroutah-register-page .btn-primary:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

/* Blue for login — matches v2 Log In button */
.astroutah-login-page .btn-primary {
    background: var(--auth-accent-blue);
    color: #ffffff;
    width: 100%;
}

.astroutah-login-page .btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
    background: #374151;
    color: var(--auth-text-primary);
}

.btn-secondary:hover {
    background: #4b5563;
}

/* ============================================================================
   MESSAGES
   ============================================================================ */

.auth-messages {
    margin-bottom: 20px;
}

.auth-messages:empty {
    margin-bottom: 0;
}

.auth-messages .message,
.auth-messages .error,
.auth-messages .success {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    text-align: center;
}

.auth-messages .error {
    background: var(--auth-accent-red);
    color: #ffffff;
}

.auth-messages .success {
    background: var(--auth-accent-green);
    color: #ffffff;
}

.auth-messages .message {
    background: var(--auth-accent-yellow);
    color: #ffffff;
}

/* ============================================================================
   PASSWORD TOGGLE
   ============================================================================ */

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .form-control {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--auth-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    line-height: 0;
}

.password-toggle:hover {
    color: var(--auth-link);
}

.eye-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.password-toggle .eye-hide { display: none; }
.password-toggle.visible .eye-show { display: none; }
.password-toggle.visible .eye-hide { display: block; }

/* ============================================================================
   ACCESS REQUIRED / UPGRADE REQUIRED
   ============================================================================ */

.astroutah-access-required,
.astroutah-upgrade-required {
    background: var(--auth-bg-container);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    margin: 40px auto;
    max-width: 600px;
    color: var(--auth-text-primary);
}

.access-required-content,
.upgrade-required-content {
    max-width: 500px;
    margin: 0 auto;
}

.access-icon,
.upgrade-icon {
    margin-bottom: 20px;
    opacity: 0.8;
}

.astroutah-access-required h3,
.astroutah-upgrade-required h3 {
    color: var(--auth-text-heading);
    margin-bottom: 12px;
    font-size: 24px;
}

.access-message,
.upgrade-message {
    color: var(--auth-text-secondary);
    margin-bottom: 24px;
    font-size: 16px;
}

.current-level {
    margin-bottom: 24px;
    padding: 12px;
    background: var(--auth-bg-input);
    border-radius: 8px;
    font-size: 14px;
    color: var(--auth-text-secondary);
}

.access-actions,
.upgrade-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.signup-prompt {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--auth-border);
    color: var(--auth-text-muted);
}

.signup-prompt a {
    color: var(--auth-link);
    font-weight: 600;
    text-decoration: none;
}

/* ============================================================================
   DASHBOARD
   ============================================================================ */

.astroutah-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-header {
    margin-bottom: 32px;
}

.welcome-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.welcome-section h2 {
    margin: 0;
    color: var(--auth-text-heading);
    font-size: 32px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.dashboard-card {
    background: var(--auth-bg-container);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    color: var(--auth-text-primary);
}

.dashboard-card h3 {
    margin: 0 0 20px 0;
    color: var(--auth-text-heading);
    font-size: 20px;
    border-bottom: 2px solid var(--auth-border);
    padding-bottom: 12px;
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--auth-border);
}

.info-label {
    color: var(--auth-text-secondary);
    font-weight: 500;
}

.info-value {
    color: var(--auth-text-primary);
}

.card-actions {
    margin-top: 20px;
}

.quick-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quick-links li {
    margin-bottom: 8px;
}

.quick-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--auth-bg-input);
    border-radius: 8px;
    text-decoration: none;
    color: var(--auth-text-primary);
    border: 1px solid var(--auth-border);
    transition: all 0.2s ease;
}

.quick-links a:hover {
    border-color: var(--auth-border-focus);
    background: #16161d;
    transform: translateX(4px);
}

.upgrade-prompt {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    padding: 20px;
    border-radius: 8px;
    margin-top: 16px;
    color: var(--auth-text-primary);
}

.upgrade-prompt ul {
    margin: 12px 0;
    padding-left: 20px;
    color: var(--auth-text-secondary);
}

.upgrade-prompt li {
    margin-bottom: 6px;
}

/* ============================================================================
   USER INFO WIDGET
   ============================================================================ */

.astroutah-user-info-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--auth-bg-container);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.user-avatar img {
    border-radius: 50%;
    display: block;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: var(--auth-text-primary);
    font-size: 14px;
}

.user-level {
    font-size: 12px;
    margin-top: 4px;
}

.user-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-action-link {
    font-size: 12px;
    color: var(--auth-link);
    text-decoration: none;
}

.user-action-link:hover {
    text-decoration: underline;
}

/* ============================================================================
   BADGES
   ============================================================================ */

.astroutah-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-guest {
    background: rgba(107, 114, 128, 0.2);
    color: var(--auth-text-muted);
}

.badge-basic {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.badge-premium {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
}

.badge-admin {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* ============================================================================
   ALREADY LOGGED IN
   ============================================================================ */

.astroutah-already-logged-in {
    text-align: center;
    padding: 40px;
    background: var(--auth-bg-container);
    border-radius: 12px;
    max-width: 500px;
    margin: 40px auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    color: var(--auth-text-primary);
}

.astroutah-already-logged-in .actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .auth-container {
        padding: 24px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .welcome-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .access-actions,
    .upgrade-actions {
        flex-direction: column;
    }

    .access-actions .btn,
    .upgrade-actions .btn {
        width: 100%;
    }
}

/* ============================================================================
   LOADING STATES
   ============================================================================ */

.astroutah-auth-form.loading {
    opacity: 0.6;
    pointer-events: none;
}

.astroutah-auth-form.loading .btn-text {
    display: none;
}

.astroutah-auth-form.loading .btn-loading {
    display: inline;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-messages > * {
    animation: fadeIn 0.25s ease;
}


/* ============================================================================
   TERMS OF SERVICE MODAL
   ============================================================================ */

.terms-modal-link {
    color: var(--auth-link);
    text-decoration: none;
}

.terms-modal-link:hover {
    text-decoration: underline;
}

.terms-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.terms-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.terms-modal-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    background: #1a1a1f;
    border: 1px solid #374151;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.terms-modal-header {
    padding: 28px 32px 20px;
    border-bottom: 1px solid #374151;
    flex-shrink: 0;
    position: relative;
}

.terms-modal-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 40px 6px 0;
}

.terms-modal-updated {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

.terms-modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.terms-modal-close:hover {
    color: #e5e7eb;
    background: #374151;
}

.terms-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #374151 transparent;
}

.terms-modal-body::-webkit-scrollbar { width: 6px; }
.terms-modal-body::-webkit-scrollbar-track { background: transparent; }
.terms-modal-body::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }

.terms-modal-footer {
    padding: 20px 32px;
    border-top: 1px solid #374151;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-shrink: 0;
    background: #111118;
}

.terms-modal-accept-btn {
    padding: 11px 28px;
    background: #10b981;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.terms-modal-accept-btn:hover {
    background: #059669;
}

.terms-modal-decline-btn {
    padding: 11px 20px;
    background: transparent;
    border: 1px solid #4b5563;
    border-radius: 8px;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.terms-modal-decline-btn:hover {
    border-color: #9ca3af;
    color: #e5e7eb;
}

/* Terms content typography (shared by modal and /terms/ page) */
.au-terms-content h3 {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    margin: 24px 0 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.au-terms-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.au-terms-content p {
    font-size: 14px;
    color: #9ca3af;
    line-height: 1.7;
    margin: 0 0 12px;
}

.au-terms-content ul {
    margin: 8px 0 16px 20px;
    padding: 0;
}

.au-terms-content ul li {
    font-size: 14px;
    color: #9ca3af;
    line-height: 1.7;
    margin-bottom: 6px;
}

.au-terms-content .au-terms-section {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #1f2937;
}

.au-terms-content .au-terms-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Standalone /terms/ page */
.au-terms-page {
    max-width: 760px;
    margin: 40px auto;
    padding: 20px;
    color: #e5e7eb;
}

.au-terms-page-header {
    margin-bottom: 40px;
    padding-bottom: 28px;
    border-bottom: 2px solid #374151;
}

.au-terms-page-header h1 {
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px;
}

.au-terms-page-meta {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 16px;
}

.au-terms-page-intro {
    font-size: 15px;
    color: #9ca3af;
    line-height: 1.7;
    margin: 0;
}

@media (max-width: 600px) {
    .terms-modal-content {
        max-height: 95vh;
        border-radius: 12px;
    }
    .terms-modal-header,
    .terms-modal-body,
    .terms-modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
    .terms-modal-footer {
        flex-direction: column-reverse;
    }
    .terms-modal-accept-btn,
    .terms-modal-decline-btn {
        width: 100%;
    }
}

/**
 * AstroUtah Auth — Nav User Widget + Profile Picture Upload Styles
 * Version: 1.2.0
 *
 * APPEND these rules to your existing auth.css.
 * They use the same CSS variables already defined at the top of auth.css.
 *
 * All selectors are namespaced with .au- to avoid any theme conflicts.
 */

/* =============================================================================
   NAV USER WIDGET — SHARED WRAPPER
   ============================================================================= */

.au-nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;   /* anchor for the dropdown */
}

/* =============================================================================
   GUEST STATE: Sign In + Join Free buttons
   ============================================================================= */

.au-nav-signin-btn,
.au-nav-join-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.au-nav-signin-btn {
    color: var(--auth-text-primary);
    border: 1px solid var(--auth-border);
    background: transparent;
}

.au-nav-signin-btn:hover {
    border-color: var(--auth-accent-blue);
    color: var(--auth-accent-blue);
    background: rgba(59, 130, 246, 0.08);
}

.au-nav-join-btn {
    color: #fff;
    background: var(--auth-accent-blue);
    border: 1px solid var(--auth-accent-blue);
}

.au-nav-join-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* =============================================================================
   AVATAR COMPONENT  (used in both trigger and dropdown header)
   ============================================================================= */

.au-avatar-wrap,
.au-dropdown-avatar-wrap {
    display: inline-flex;
    position: relative;
    flex-shrink: 0;
}

/* The circular image */
.au-avatar-img {
    display: block;
    border-radius: 50%;
    object-fit: cover;
    background: var(--auth-bg-input);
}

/* Hide image when it fails to load (JS adds this class) */
.au-avatar-img--hidden {
    display: none !important;
}

/* Initials fallback — visible when image is hidden OR not yet loaded */
.au-avatar-initials {
    display: none;   /* hidden by default; shown only when image fails */
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    user-select: none;
}

/* Show initials when sibling image is hidden */
.au-avatar-img--hidden ~ .au-avatar-initials {
    display: flex;
}

/* Size the initials to match the image */
.au-avatar-trigger .au-avatar-initials {
    width: 36px;
    height: 36px;
    font-size: 13px;
}

.au-dropdown-header .au-avatar-initials {
    width: 48px;
    height: 48px;
    font-size: 16px;
}

/* =============================================================================
   TRIGGER BUTTON
   ============================================================================= */

.au-avatar-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px 3px 3px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    color: var(--auth-text-secondary);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.au-avatar-trigger:hover,
.au-avatar-trigger:focus-visible,
.au-avatar-trigger[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--auth-border);
    outline: none;
}

.au-avatar-trigger .au-avatar-img {
    width: 36px;
    height: 36px;
}

.au-avatar-caret {
    color: var(--auth-text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.au-avatar-trigger[aria-expanded="true"] .au-avatar-caret {
    transform: rotate(180deg);
}

/* =============================================================================
   DROPDOWN PANEL
   ============================================================================= */

.au-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--auth-bg-container);
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;

    /* Entrance animation */
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;   /* blocked while hidden */
}

/* Visible state (class added by JS) */
.au-user-dropdown.au-dropdown--visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Header row: avatar + name + level */
.au-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.au-dropdown-header .au-avatar-img {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.au-dropdown-user-info {
    min-width: 0;  /* allow text truncation */
}

.au-dropdown-name {
    display: block;
    color: var(--auth-text-heading);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.au-dropdown-level {
    margin-top: 3px;
    font-size: 12px;
}

/* Divider */
.au-dropdown-divider {
    height: 1px;
    background: var(--auth-border);
    margin: 0;
}

/* Navigation links */
.au-dropdown-nav {
    padding: 6px 0;
}

.au-dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 14px;
    color: var(--auth-text-primary) !important;
    text-decoration: none;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.au-dropdown-link svg {
    color: var(--auth-text-muted);
    flex-shrink: 0;
    transition: color 0.12s ease;
}

.au-dropdown-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.au-dropdown-link:hover svg {
    color: var(--auth-accent-blue);
}

.au-dropdown-link:focus-visible {
    outline: 2px solid var(--auth-accent-blue);
    outline-offset: -2px;
}

/* Footer: Sign Out */
.au-dropdown-footer {
    padding: 6px 0;
}

.au-dropdown-signout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 16px;
    font-size: 14px;
    color: var(--auth-accent-red);
    text-decoration: none;
    transition: background-color 0.12s ease;
}

.au-dropdown-signout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.au-dropdown-signout svg {
    flex-shrink: 0;
}

/* =============================================================================
   PROFILE PICTURE UPLOAD SECTION  (settings page)
   ============================================================================= */

.au-profile-pic-section {
    background: var(--auth-bg-container);
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 24px;
}

.au-section-title {
    color: var(--auth-text-heading);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 6px;
}

.au-section-desc {
    color: var(--auth-text-secondary);
    font-size: 14px;
    margin: 0 0 24px;
}

/* Editor layout: preview circle + controls side by side */
.au-profile-pic-editor {
    display: flex;
    align-items: center;
    gap: 28px;
    flex-wrap: wrap;
}

/* Preview circle */
.au-pic-preview-wrap {
    flex-shrink: 0;
}

.au-pic-preview {
    position: relative;
    width: 100px;
    height: 100px;
}

.au-pic-preview .au-avatar-img {
    width: 100px;
    height: 100px;
    border: 2px solid var(--auth-border);
    transition: opacity 0.2s ease;
}

.au-pic-preview .au-avatar-initials {
    width: 100px;
    height: 100px;
    font-size: 28px;
    border: 2px solid var(--auth-border);
}

/* Show initials fallback in preview too */
.au-pic-preview .au-avatar-img--hidden ~ .au-avatar-initials {
    display: flex;
}

/* Controls column */
.au-pic-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

/* Hide the actual file input — we use the label as the button */
.au-pic-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

.au-pic-upload-btn {
    cursor: pointer;
}

.au-pic-upload-btn:hover {
    opacity: 0.85;
}

/* Remove / danger ghost button */
.btn-danger-ghost {
    background: transparent;
    border: 1px solid var(--auth-accent-red);
    color: var(--auth-accent-red);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn-danger-ghost:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-danger-ghost:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Status message */
.au-pic-status {
    font-size: 13px;
    min-height: 20px;
}

.au-pic-status--success { color: var(--auth-accent-green); }
.au-pic-status--error   { color: var(--auth-accent-red); }
.au-pic-status--info    { color: var(--auth-text-secondary); }

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 480px) {
    /* Stack sign-in buttons vertically on very small screens */
    .au-nav-user--guest {
        flex-direction: column;
        gap: 6px;
    }

    /* Dropdown goes full-width below trigger on mobile */
    .au-user-dropdown {
        right: -12px;
        width: calc(100vw - 24px);
        max-width: 300px;
    }

    /* Profile picture editor stacks vertically */
    .au-profile-pic-editor {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =============================================================================
   FIX #1 — Visited link colors: prevent browser turning them blue
   ============================================================================= */
.au-dropdown-link:visited        { color: var(--auth-text-primary); !important; }
.au-dropdown-link:visited:hover  { color: #fff; }
.au-dropdown-signout:visited     { color: var(--auth-accent-red); }

/* Upgrade teaser link — golden styling for Basic members */
.au-dropdown-link--upgrade { color: var(--auth-accent-yellow, #f59e0b); background: rgba(245,158,11,0.06); }
.au-dropdown-link--upgrade:visited { color: var(--auth-accent-yellow, #f59e0b); }
.au-dropdown-link--upgrade svg { color: var(--auth-accent-yellow, #f59e0b) !important; }
.au-dropdown-link--upgrade:hover,
.au-dropdown-link--upgrade:visited:hover { background: rgba(245,158,11,0.14); color: #fbbf24; }
.au-dropdown-link--upgrade:hover svg { color: #fbbf24 !important; }

/* =============================================================================
   FEATURES / UPGRADE MODAL
   ============================================================================= */

.au-features-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.au-features-modal.au-features-modal--open { display: flex; }

.au-features-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.78);
    cursor: pointer;
}

.au-features-dialog {
    position: relative;
    background: var(--auth-bg-container);
    border: 1px solid var(--auth-border);
    border-radius: 14px;
    width: 92%;
    max-width: 640px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.65);
    overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.au-features-header {
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--auth-border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}
.au-features-title {
    color: var(--auth-text-heading);
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px;
}
.au-features-subtitle { color: var(--auth-text-secondary); font-size: 13px; margin: 0; }
.au-features-close {
    background: transparent;
    border: none;
    color: var(--auth-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s, background-color 0.15s;
}
.au-features-close:hover { color: var(--auth-text-primary); background: rgba(255,255,255,0.08); }

/* ── Scrollable body ─────────────────────────────────────────────────────── */
.au-features-body { overflow-y: auto; flex: 1; padding: 20px 24px; }

/* ── 3-column plan comparison table ──────────────────────────────────────── */
.au-plan-table { width: 100%; }

/* Header row: plan names & prices */
.au-plan-header {
    display: grid;
    grid-template-columns: 1fr 90px 90px 100px;
    gap: 0;
    margin-bottom: 4px;
}

.au-plan-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 6px 10px;
    text-align: center;
    border-radius: 8px 8px 0 0;
}

.au-plan-col--premium {
    background: rgba(245,158,11,0.08);
    border: 1px solid rgba(245,158,11,0.3);
    border-bottom: none;
}

.au-plan-col--current {
    outline: 2px solid var(--auth-accent-blue, #3b82f6);
    outline-offset: -2px;
}

.au-plan-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--auth-text-heading);
    margin-bottom: 2px;
}
.au-plan-col--premium .au-plan-name { color: var(--auth-accent-yellow, #f59e0b); }

.au-plan-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--auth-text-heading);
    line-height: 1.1;
}
.au-plan-price span { font-size: 12px; font-weight: 500; color: var(--auth-text-muted); }

.au-plan-current-tag {
    margin-top: 5px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(59,130,246,0.2);
    color: var(--auth-accent-blue, #3b82f6);
    border: 1px solid rgba(59,130,246,0.3);
    white-space: nowrap;
}

/* Feature rows */
.au-plan-row {
    display: grid;
    grid-template-columns: 1fr 90px 90px 100px;
    gap: 0;
    border-bottom: 1px solid var(--auth-border);
}
.au-plan-row:last-child { border-bottom: none; }

.au-plan-feature-col {
    padding: 10px 8px 10px 0;
    font-size: 13px;
    color: var(--auth-text-primary);
    display: flex;
    align-items: center;
}

.au-plan-col:not(.au-plan-header .au-plan-col) {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 6px;
    flex-direction: row;
}

.au-plan-row .au-plan-col--premium {
    background: rgba(245,158,11,0.05);
    border-left: 1px solid rgba(245,158,11,0.3);
    border-right: 1px solid rgba(245,158,11,0.3);
    border-radius: 0;
}
.au-plan-row:last-child .au-plan-col--premium {
    border-radius: 0 0 6px 6px;
    border-bottom: 1px solid rgba(245,158,11,0.3);
}

.au-plan-check { color: var(--auth-accent-green, #22c55e); }
.au-plan-dash  { color: var(--auth-text-muted); font-size: 16px; line-height: 1; }

/* ── Footer CTA ──────────────────────────────────────────────────────────── */
.au-features-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--auth-border);
    flex-shrink: 0;
    text-align: center;
}
.au-features-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 32px;
    width: 100%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000 !important;
    font-size: 15px;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}
.au-features-cta-btn:hover { opacity: 0.9; transform: translateY(-1px); color: #000 !important; }
.au-features-cta-note { margin: 10px 0 0; font-size: 12px; color: var(--auth-text-muted); }
.au-features-footer--is-premium .au-features-cta-btn { display: none; }
.au-features-footer--is-premium .au-features-cta-note {
    font-size: 14px;
    color: var(--auth-accent-green, #22c55e);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
    .au-plan-header,
    .au-plan-row { grid-template-columns: 1fr 72px 72px 80px; }
    .au-plan-name  { font-size: 11px; }
    .au-plan-price { font-size: 16px; }
    .au-plan-feature-col { font-size: 12px; }
    .au-features-dialog { max-height: 92vh; }
}

/* ============================================================================
   LEGAL FOOTER — Terms of Service & Privacy Policy links
   Appears below auth containers and dashboard panels on all user-facing pages.
   ============================================================================ */

.au-legal-footer {
    text-align: center;
    margin-top: 20px;
    padding: 12px 0 4px;
    font-size: 12px;
    color: var(--auth-text-muted, #6b7280);
    line-height: 1.6;
}

.au-legal-footer a {
    color: var(--auth-text-muted, #6b7280);
    text-decoration: none;
    transition: color 0.15s;
}

.au-legal-footer a:hover {
    color: var(--auth-link, #f59e0b);
    text-decoration: underline;
}

.au-legal-footer .au-legal-sep {
    margin: 0 8px;
    opacity: 0.4;
}

/* Slightly more prominent on the register page where legal consent matters */
.astroutah-register-page .au-legal-footer {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--auth-border, rgba(255,255,255,0.08));
}

/* On the dashboard the footer sits outside the card grid */
.astroutah-dashboard .au-legal-footer {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--auth-border, rgba(255,255,255,0.08));
}