/* ============================================================
   Frontend Auth Popup fap-style.css
   ============================================================ */

/* ---- Custom properties ---- */
:root {
    --fap-error:          #DC2626;
    --fap-success:        #16A34A;
    --fap-warning:        #D97706;
    --fap-radius: 14px;
    --fap-radius-sm: 30px;
    --fap-shadow:         0 20px 60px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.1);
    --fap-transition:     0.2s ease;
}

/* ---- Overlay ---- */
.fap-overlay {
    position: fixed;
     inset: 0;
     z-index: 999999;
     display: flex;
     align-items: center;
     justify-content: center;
     background: var(--white_trans);
     backdrop-filter: blur(1px);
     -webkit-backdrop-filter: blur(3px);
     padding: 16px;
     opacity: 0;
     pointer-events: none;
     transition: opacity 0.25s ease;

}

.fap-overlay.fap-visible {
    opacity: 1;
    pointer-events: all;
}

.fap-overlay[hidden] {
    display: flex !important; /* keep flex for animation, visibility via opacity */
    visibility: hidden;
}

.fap-overlay.fap-visible[hidden] {
    visibility: visible;
}

/* ---- Modal ---- */
.fap-modal {
    position: relative;
    background: var(--white);
    border-radius: var(--fap-radius);
    box-shadow: var(--fap-shadow);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 36px 36px 32px;
    transform: translateY(16px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.fap-overlay.fap-visible .fap-modal {
    transform: translateY(0) scale(1);
}

@media (max-width: 480px) {
    .fap-modal {
        padding: 28px 22px 24px;
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        transform: translateY(32px);
    }
    .fap-overlay.fap-visible .fap-modal {
        transform: translateY(0);
    }
}

/* ---- Close button ---- */
.fap-close {
    position: absolute;
    top: 6px;
    right: -4px;
    width: 32px;
    height: 32px;
    border: none;
    /* background: var(--bright-grey); */
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark-light);
    transition: background var(--fap-transition), color var(--fap-transition);
    line-height: 1;
    padding: 11px;
}

.fap-close:hover,
.fap-close:focus-visible {
    background: var(--bright-grey);
    color: var(--dark);
    outline: none;
}

/* ---- Brand ---- */
.fap-brand {
    text-align: center;
    margin-bottom: 24px;
}

.fap-brand .fap-logo {
    max-height: 40px;
    width: auto;
}

.fap-site-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--red);
    letter-spacing: -0.5px;
}

/* ---- Tabs ---- */
.fap-tabs {
    display: flex;
    border-radius: var(--fap-radius-sm);
    background: var(--bright-grey);
    padding: 4px;
    margin-bottom: 24px;
    gap: 2px;
}

.fap-tab {
    flex: 1;
    padding: 9px 12px;
    border: none;
    background: transparent;
    border-radius: 26px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--dark-light);
    transition: all var(--fap-transition);
    text-align: center;
    margin: 0;
}

.fap-tab:hover {
    color: var(--dark);
}

.fap-tab--active {
    background: #fff;
    color: var(--red) !important;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

/* ---- Notice ---- */
.fap-notice {
    border-radius: var(--fap-radius-sm);
    padding: 12px 14px;
    font-size: 13.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.45;
}

.fap-notice[hidden] { display: none !important; }

.fap-notice--error   { background: #FEF2F2; color: var(--fap-error);   border: 1px solid #FECACA; }
.fap-notice--success { background: #F0FDF4; color: var(--fap-success); border: 1px solid #BBF7D0; }
.fap-notice--info    { background: var(--red-light); color: var(--red); border: 1px solid #C7D2FE; }

/* ---- Panels ---- */
.fap-panel { display: none; }
.fap-panel--active { display: block; }

/* ---- Form ---- */
.fap-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fap-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 380px) {
    .fap-field-row { grid-template-columns: 1fr; }
}

.fap-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fap-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fap-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--dark);
}

.fap-forgot-link {
    font-size: 12.5px;
    color: var(--red);
    text-decoration: none;
    transition: color var(--fap-transition);
}

.fap-forgot-link:hover { color: var(--red-med); text-decoration: underline; }

/* ---- Input wrapper ---- */
.fap-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.fap-input-icon {
    position: absolute;
    left: 12px;
    color: var(--dark-light);
    pointer-events: none;
    flex-shrink: 0;
}

input[type="password"].fap-input,input[type="text"].fap-input,input[type="email"].fap-input {
    width: 100%;
    padding: 10px 42px 10px 38px;
    border: 1.5px solid var(--bright-grey);
    border-radius: var(--fap-radius-sm);
    background: var(--bright-grey);
    font-size: 14px;
    color: var(--dark);
    transition: border-color var(--fap-transition), box-shadow var(--fap-transition), background var(--fap-transition);
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

/* Inputs without icon (name fields) */
.fap-field-row .fap-input {
    padding-left: 14px;
}

.fap-input::placeholder { color: #9CA3AF; }

.fap-input:focus {
    outline: none;
    border-color: var(--red-light);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.fap-input.fap-input--error {
    border-color: var(--fap-error);
}

.fap-toggle-pw {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    padding: 0px;
    cursor: pointer;
    color: var(--dark-light);
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: color var(--fap-transition);
    text-align: right;
    width: 25px;
    margin: 0px;
}

.fap-toggle-pw:hover { color: var(--dark); }

/* ---- Password strength ---- */
.fap-strength-bar {
    height: 4px;
    background: var(--bright-grey);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.fap-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s ease, background 0.3s ease;
}

.fap-strength-label {
    font-size: 11px;
    color: var(--dark-light);
    font-weight: 500;
}

/* ---- Remember me ---- */
.fap-remember { flex-direction: row; align-items: center; }

/* ---- Checkboxes ---- */
.fap-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 2px;
}

.fap-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--dark-light);
    line-height: 1.45;
    user-select: none;
}

.fap-checkbox-label a {
    color: var(--red);
    text-decoration: none;
}
.fap-checkbox-label a:hover { text-decoration: underline; }

.fap-checkbox[type=checkbox]:not(:checked), .fap-checkbox[type=checkbox]:checked,.fap-checkbox[type=checkbox] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.fap-checkbox-custom {
    flex-shrink: 0;
    width: 25px;
    height: 25px;
    border: 1.5px solid var(--bright-grey);
    border-radius: 24px;
    background: var(--bright-grey);
    margin-top: 1px;
    transition: all var(--fap-transition);
    position: relative;
}

.fap-checkbox:checked + .fap-checkbox-custom {
    background: var(--red);
    border-color: var(--red);
}

.fap-checkbox:checked + .fap-checkbox-custom::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 9px;
    height: 13px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.fap-checkbox:focus-visible + .fap-checkbox-custom {
    box-shadow: 0 0 0 3px rgba(79,70,229,.2);
}

/* ---- Primary button ---- */
.fap-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: none;
    border-radius: var(--fap-radius-sm);
    cursor: pointer;
    font-size: 14.5px;
    font-weight: 600;
    transition: all var(--fap-transition);
    position: relative;
    width: 100%;
}

.fap-btn--primary {
    background: var(--red);
    color: #fff;
}

.fap-btn--primary:hover:not(:disabled) {
    background: var(--red-med);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(79,70,229,.3);
}

.fap-btn--primary:active:not(:disabled) {
    transform: translateY(0);
}

.fap-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ---- Spinner ---- */
.fap-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fap-spin 0.7s linear infinite;
}

.fap-btn-spinner[hidden] { display: none !important; }

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

/* ---- Divider ---- */
.fap-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 16px;
    color: var(--dark-light);
    font-size: 12px;
}

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

/* ---- Social buttons ---- */
.fap-social-btns {
    display: flex;
    gap: 10px;
}

.fap-social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1.5px solid var(--bright-grey);
    border-radius: var(--fap-radius-sm);
    background: var(--white);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--dark);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--fap-transition);
    white-space: nowrap;
    margin: 0 10px 10px 0;
}

.fap-social-btn:hover {
    border-color: #9CA3AF;
    background: var(--bright-grey);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.fap-social-btn:active { transform: translateY(0); }

.fap-social-btn--twitter { color: #000; }
.fap-social-btn--twitter svg { fill: #000; }

/* ---- Floating open button ---- */
.glow-button a.fap-open-btn, a.fap-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 100px;
    /* font-size: 13px; */
    cursor: pointer;
    transition: all var(--fap-transition);
    text-decoration: none;
    margin: 0;
    /* padding: 8px 20px; */
}

.fap-open-btn:hover {
}

.fap-floating-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 999998;
    box-shadow: 0 4px 20px rgba(79,70,229,.35);
}

/* ---- Logged-in account button ---- */
.glow-button a.fap-account-btn, a.fap-account-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 2px 14px 2px 2px;
    border-radius: 100px;
    /* background: #fff; */
    /* color: var(--dark); */
    border: 1.5px solid var(--bright-grey);
    transition: all var(--fap-transition);
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}


/* Avatar circle */
.fap-account-avatar {
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: hsl(var(--fap-avatar-hue, 250deg), 60%, 55%);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Initials shown via pseudo-element when gravatar is unavailable */
.fap-account-avatar::after {
    content: attr(data-initials);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    /* Hidden when img is visible */
    opacity: 0;
    transition: opacity 0.15s;
}

/* When image fails to load, JS adds this class */
.fap-account-avatar.fap-avatar--fallback::after {
    opacity: 1;
}

.fap-account-avatar__img {
    width: 25px;
    height: 25px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    position: relative;
    z-index: 1;
}

.fap-account-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fap-account-chevron {
    color: var(--dark-light);
    flex-shrink: 0;
    transition: transform var(--fap-transition);
}

.fap-account-btn:hover .fap-account-chevron {
    transform: translateY(1px);
    color: var(--red);
}

/* Floating variant */
.fap-account-btn.fap-floating-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 999998;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    background: #fff;
}

.fap-account-btn.fap-floating-btn:hover {
    box-shadow: 0 6px 24px rgba(79,70,229,.2);
}

/* ---- Scrollbar ---- */
.fap-modal::-webkit-scrollbar { width: 5px; }
.fap-modal::-webkit-scrollbar-track { background: transparent; }
.fap-modal::-webkit-scrollbar-thumb { background: var(--bright-grey); border-radius: 4px; }
