/* ==========================================================================
   sbarUp - Authentication Screen (Pure Monochrome Black / White)
   Adapts automatically to phone mode (Light / Dark). No blue colors.
   ========================================================================== */

:root {
    /* Dark Mode (Default) */
    --auth-bg: #000000;
    --auth-text: #ffffff;
    --auth-subtext: rgba(255, 255, 255, 0.65);
    --auth-card-bg: rgba(255, 255, 255, 0.08);
    --auth-card-border: rgba(255, 255, 255, 0.16);
    --auth-card-hover: rgba(255, 255, 255, 0.14);
    --auth-input-bg: rgba(255, 255, 255, 0.07);
    --auth-input-border: rgba(255, 255, 255, 0.16);
    --auth-input-placeholder: rgba(255, 255, 255, 0.40);
    --auth-input-focus: #ffffff;
    --auth-input-focus-ring: rgba(255, 255, 255, 0.22);
    --auth-btn-bg: #ffffff;
    --auth-btn-text: #000000;
    --auth-btn-shadow: 0 8px 24px rgba(255, 255, 255, 0.12);
    --auth-divider: rgba(255, 255, 255, 0.16);
    --auth-divider-text: rgba(255, 255, 255, 0.45);
    --auth-link: #ffffff;
    --auth-legal-text: rgba(255, 255, 255, 0.50);
}

@media (prefers-color-scheme: light) {
    :root {
        /* Light Mode */
        --auth-bg: #ffffff;
        --auth-text: #000000;
        --auth-subtext: rgba(0, 0, 0, 0.60);
        --auth-card-bg: #f4f4f6;
        --auth-card-border: rgba(0, 0, 0, 0.10);
        --auth-card-hover: #ebebec;
        --auth-input-bg: #f4f4f6;
        --auth-input-border: rgba(0, 0, 0, 0.12);
        --auth-input-placeholder: rgba(0, 0, 0, 0.40);
        --auth-input-focus: #000000;
        --auth-input-focus-ring: rgba(0, 0, 0, 0.15);
        --auth-btn-bg: #000000;
        --auth-btn-text: #ffffff;
        --auth-btn-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
        --auth-divider: rgba(0, 0, 0, 0.12);
        --auth-divider-text: rgba(0, 0, 0, 0.42);
        --auth-link: #000000;
        --auth-legal-text: rgba(0, 0, 0, 0.45);
    }
}

.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background-color: var(--auth-bg);
    color: var(--auth-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: calc(28px + env(safe-area-inset-top, 0px)) 24px calc(20px + env(safe-area-inset-bottom, 0px)) 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s;
}

.auth-overlay[hidden] {
    display: none !important;
}

.auth-overlay.is-closing {
    opacity: 0;
    transform: scale(0.96);
    pointer-events: none;
}

body.auth-locked {
    overflow: hidden !important;
}

body.auth-locked .topbar,
body.auth-locked .screen,
body.auth-locked .tabbar {
    pointer-events: none !important;
    user-select: none !important;
    filter: blur(2px);
    transition: filter 0.3s ease;
}

.auth-container {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    justify-content: center;
    padding: 8px 0 20px 0;
}

/* App Branding: typography only, no logo */
.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    user-select: none;
}

.auth-brand__name {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--auth-text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
}

/* Titles */
.auth-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.025em;
    text-align: center;
    margin: 0 0 8px 0;
    color: var(--auth-text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
}

.auth-subtitle {
    font-size: 14px;
    line-height: 1.45;
    color: var(--auth-subtext);
    text-align: center;
    max-width: 290px;
    margin: 0 auto 28px auto;
}

/* Social Button (Google) */
.auth-social-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.auth-social-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--auth-card-border);
    background: var(--auth-card-bg);
    border-radius: 14px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--auth-text);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

.auth-social-btn:hover {
    background: var(--auth-card-hover);
}

.auth-social-btn:active {
    transform: scale(0.97);
}

.auth-social-btn svg {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}

/* Divider "Oppure" */
.auth-divider {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 4px 0 20px 0;
    color: var(--auth-divider-text);
    font-size: 13px;
    font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-divider);
}

/* Forms */
.auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 8px;
}

.auth-input {
    width: 100%;
    height: 54px;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: 14px;
    padding: 0 18px;
    color: var(--auth-text);
    font-size: 15px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.auth-input::placeholder {
    color: var(--auth-input-placeholder);
}

.auth-input:focus {
    border-color: var(--auth-input-focus);
    box-shadow: 0 0 0 3px var(--auth-input-focus-ring);
}

/* Forgot Password Link */
.auth-forgot-link {
    align-self: flex-end;
    background: none;
    border: none;
    padding: 4px 0;
    margin: 6px 0 18px 0;
    color: var(--auth-text);
    opacity: 0.85;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.auth-forgot-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.auth-input-spacing {
    height: 16px;
}

/* Submit Action Button: solid monochrome high-contrast */
.auth-action-btn {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    width: 100%;
    height: 52px;
    border-radius: 9999px;
    background: var(--auth-btn-bg);
    color: var(--auth-btn-text);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--auth-btn-shadow);
    transition: transform 0.15s ease, opacity 0.15s ease;
    user-select: none;
    margin-top: 6px;
}

.auth-action-btn:hover {
    opacity: 0.92;
}

.auth-action-btn:active {
    transform: scale(0.975);
    opacity: 0.85;
}

.auth-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Switch link (Hai già un account? Accedi / Non hai un account? Registrati) */
.auth-switch {
    margin-top: 22px;
    font-size: 14px;
    color: var(--auth-subtext);
    text-align: center;
}

.auth-switch-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0 0 0 4px;
    color: var(--auth-link);
    font-weight: 600;
    font-size: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Status / Alert message */
.auth-error {
    width: 100%;
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #ef4444;
    font-size: 13.5px;
    text-align: center;
    line-height: 1.4;
    animation: authFadeIn 0.2s ease-out;
}

.auth-success {
    width: 100%;
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #10b981;
    font-size: 13.5px;
    text-align: center;
    line-height: 1.4;
    animation: authFadeIn 0.2s ease-out;
}

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

/* Legal Footer Links */
.auth-legal {
    width: 100%;
    text-align: center;
    font-size: 12.5px;
    color: var(--auth-legal-text);
    padding-top: 16px;
    user-select: none;
}

.auth-legal a,
.auth-legal button {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-size: inherit;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.auth-legal a:hover,
.auth-legal button:hover {
    opacity: 0.8;
}

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

/* User Account Profile inside Settings Tab */
.account-profile-card {
    background: var(--elev, #1c1c1e);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 20px;
    border: 1px solid var(--hairline, rgba(84, 84, 88, 0.3));
    display: flex;
    align-items: center;
    gap: 14px;
}

.account-profile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--auth-text, #ffffff);
    color: var(--auth-bg, #000000);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    flex-shrink: 0;
}

.account-profile-info {
    flex-grow: 1;
    overflow: hidden;
}

.account-profile-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--label, #fff);
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-profile-email {
    font-size: 13.5px;
    color: var(--label-2, rgba(235, 235, 245, 0.6));
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-profile-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 9999px;
    background: rgba(120, 120, 128, 0.2);
    color: var(--label, #fff);
    margin-top: 4px;
}

.btn--logout {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn--logout:hover {
    background: rgba(239, 68, 68, 0.2);
}
