/* ===================================================
   AUTH UI - Login/Register Modal & User Indicator
   Tokens kommen aus css/base.css
   Header-Auth-Elemente sind in base.css definiert
   =================================================== */

/* ===================================================
   AUTH MODAL
   =================================================== */
.auth-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-overlay.active {
    display: flex;
}

.auth-modal {
    background: var(--c24-white, var(--ww-bg));
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: authSlideUp 0.25s ease-out;
}

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

/* Modal Header */
.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 0;
}

.auth-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--c24-text, var(--ww-text));
}

.auth-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--c24-bg, var(--ww-bg-alt));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--c24-text-light, var(--ww-text-light));
    transition: background 0.2s;
}

.auth-modal-close:hover {
    background: var(--c24-border-light, var(--ww-border-light));
}

/* Tabs */
.auth-tabs {
    display: flex;
    margin: 1rem 1.5rem 0;
    border-bottom: 2px solid var(--c24-border-light, var(--ww-border-light));
}

.auth-tab {
    flex: 1;
    padding: 0.75rem 0;
    text-align: center;
    background: none;
    border: none;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--c24-text-light, var(--ww-text-light));
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.auth-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: background 0.2s;
}

.auth-tab.active {
    color: var(--c24-primary, var(--ww-secondary));
}

.auth-tab.active::after {
    background: var(--c24-accent, var(--ww-primary));
}

/* Form panels */
.auth-panel {
    display: none;
    padding: 1.5rem;
}

.auth-panel.active {
    display: block;
}

/* Form fields */
.auth-field {
    margin-bottom: 1rem;
}

.auth-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--c24-text, var(--ww-text));
    margin-bottom: 0.35rem;
}

.auth-field input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--c24-border, var(--ww-border));
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--c24-text, var(--ww-text));
    background: var(--c24-white, var(--ww-bg));
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--c24-accent, var(--ww-primary));
    box-shadow: 0 0 0 3px rgba(255, 223, 78, 0.2);
}

.auth-field input.error {
    border-color: var(--c24-danger, var(--ww-danger));
}

/* Password visibility toggle */
.auth-password-wrapper {
    position: relative;
}

.auth-password-wrapper input {
    padding-right: 2.5rem;
}

.auth-password-toggle {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--c24-text-muted, var(--ww-text-muted));
    padding: 0.2rem;
}

.auth-password-toggle:hover {
    color: var(--c24-text, var(--ww-text));
}

/* Submit button */
.auth-submit-btn {
    width: 100%;
    padding: 0.8rem;
    background: var(--c24-accent, var(--ww-primary));
    color: var(--c24-text, var(--ww-text));
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.auth-submit-btn:hover:not(:disabled) {
    background: var(--c24-accent-hover, var(--ww-primary-hover));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Messages */
.auth-message {
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: none;
}

.auth-message.error {
    display: block;
    background: #fef2f2;
    color: var(--c24-danger, var(--ww-danger));
    border: 1px solid #fecaca;
}

.auth-message.success {
    display: block;
    background: #f0fdf4;
    color: var(--c24-success, var(--ww-success));
    border: 1px solid #bbf7d0;
}

.auth-message.info {
    display: block;
    background: var(--c24-primary-light, var(--ww-secondary-light));
    color: var(--c24-primary, var(--ww-secondary));
    border: 1px solid #bfdbfe;
}

/* Privacy notice */
.auth-privacy {
    font-size: 0.75rem;
    color: var(--c24-text-muted, var(--ww-text-muted));
    text-align: center;
    margin-top: 1rem;
    line-height: 1.5;
}

.auth-privacy a {
    color: var(--c24-primary, var(--ww-secondary));
    text-decoration: underline;
}

/* Verification state */
.auth-verification-notice {
    text-align: center;
    padding: 2rem 1.5rem;
}

.auth-verification-notice svg {
    width: 48px;
    height: 48px;
    color: var(--c24-accent, var(--ww-primary));
    margin-bottom: 1rem;
}

.auth-verification-notice h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--c24-text, var(--ww-text));
}

.auth-verification-notice p {
    font-size: 0.9rem;
    color: var(--c24-text-light, var(--ww-text-light));
    line-height: 1.5;
}

/* ===================================================
   SAVE CTA (in result section)
   =================================================== */
.auth-save-cta {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--ww-primary-light, #fff8e1) 0%, #fffdf5 100%);
    border: 1px solid #fde68a;
    border-radius: var(--radius-lg);
}

.auth-save-cta.hidden {
    display: none;
}

.auth-save-cta-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.auth-save-cta-header svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: var(--ww-secondary, #1a3a4f);
    margin-top: 0.1rem;
}

.auth-save-cta h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--c24-text, var(--ww-text));
    margin: 0;
}

.auth-save-cta p {
    font-size: 0.85rem;
    color: var(--c24-text-light, var(--ww-text-light));
    margin: 0 0 1rem;
    padding-left: 2.25rem;
    line-height: 1.5;
}

.auth-save-cta-actions {
    display: flex;
    gap: 0.75rem;
    padding-left: 2.25rem;
    flex-wrap: wrap;
}

.auth-save-cta-btn {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.auth-save-cta-btn.primary {
    background: var(--c24-accent, var(--ww-primary));
    color: var(--c24-text, var(--ww-text));
    font-weight: 600;
}

.auth-save-cta-btn.primary:hover {
    background: var(--c24-accent-hover, var(--ww-primary-hover));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.auth-save-cta-btn.secondary {
    background: transparent;
    color: var(--c24-text-light, var(--ww-text-light));
    border: 1px solid var(--c24-border, var(--ww-border));
}

.auth-save-cta-btn.secondary:hover {
    border-color: var(--c24-text-light, var(--ww-text-light));
}

/* Sync status indicator */
.auth-sync-status {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--c24-success, var(--ww-success));
    margin-top: 1.5rem;
}

.auth-sync-status.active {
    display: flex;
}

.auth-sync-status svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Dashboard hint box */
.auth-dashboard-hint {
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.2rem;
    background: #f0f7ff;
    border: 1px solid #bdd8f5;
    border-radius: 10px;
    margin-top: 0.75rem;
}

.auth-dashboard-hint.active {
    display: flex;
}

.auth-dashboard-hint-content {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.88rem;
    color: #1a3a5c;
    line-height: 1.5;
}

.auth-dashboard-hint-content svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke: #3b82f6;
    margin-top: 1px;
}

.auth-dashboard-hint-content a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-dashboard-hint-content a:hover {
    color: #1d4ed8;
}

.auth-dashboard-hint-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    align-self: flex-end;
    padding: 0.5rem 1rem;
    background: #2563eb;
    color: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.auth-dashboard-hint-btn:hover {
    background: #1d4ed8;
    color: #fff;
}

.auth-dashboard-hint-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Loading spinner */
.auth-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(26, 26, 26, 0.2);
    border-top-color: var(--ww-text, #1a1a1a);
    border-radius: 50%;
    animation: authSpin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 0.4rem;
}

@keyframes authSpin {
    to { transform: rotate(360deg); }
}

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (max-width: 768px) {
    .auth-modal {
        max-width: 100%;
        margin: 0.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .auth-save-cta-actions {
        flex-direction: column;
        padding-left: 0;
    }

    .auth-save-cta p {
        padding-left: 0;
    }
}
