/**
 * Authentication Modal Styles
 * Refactored to match OpttiAI dashboard design
 */

.alttext-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    pointer-events: auto;
}

/* Modal Overlay with fade animation */
.alttext-auth-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: block;
    padding: 24px;
    animation: auth-fade-in 0.2s ease-out;
}

@keyframes auth-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
}
}

/* Modal Content Box */
.alttext-auth-modal__content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22), 0 4px 12px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.06);
    max-width: 560px;
    width: min(calc(100vw - 48px), 560px);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: auth-scale-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

@keyframes auth-scale-in {
    from {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Close Button - Top Right */
.alttext-auth-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
    z-index: 10;
}

.alttext-auth-modal__close:hover {
    background: #f3f4f6;
    color: #6b7280;
}

/* Header Section - Centered, No Icon */
.alttext-auth-modal__header {
    text-align: center;
    padding: 36px 44px 20px;
}

.alttext-auth-modal__title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px;
    line-height: 1.18;
}

.alttext-auth-modal__subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.45;
}

.alttext-auth-modal__context {
    margin: 10px 0 0;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 600;
    color: #111827;
}

.alttext-auth-modal__context[hidden] {
    display: none;
}

/* Body Section */
.alttext-auth-modal__body {
    padding: 0 44px 28px;
}

.alttext-auth-modal__value-step,
.alttext-auth-modal__form-step {
    min-height: 190px;
}

.alttext-auth-modal__value-step[hidden],
.alttext-auth-modal__form-step[hidden] {
    display: none;
}

.alttext-auth-modal__value-list {
    display: grid;
    gap: 10px;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}

.alttext-auth-modal__value-list li {
    position: relative;
    padding-left: 18px;
    color: #374151;
    font-size: 14px;
    line-height: 1.45;
}

.alttext-auth-modal__value-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #3A74FF;
}

.alttext-auth-modal__intro-actions {
    display: grid;
    gap: 4px;
}

.alttext-auth-modal__intro-cta {
    width: 100%;
    min-width: 0;
    margin-bottom: 6px;
}

.alttext-auth-modal__secondary-cta {
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #3A74FF;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
}

.alttext-auth-modal__secondary-cta:hover,
.alttext-auth-modal__secondary-cta:focus-visible {
    background: #f3f6ff;
    outline: none;
}

.alttext-auth-modal__form-step {
    padding-top: 18px;
    border-top: 1px solid #e5e7eb;
}

/* Form Styling */
.alttext-auth-form {
    /* No heading needed - title is in header */
}

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

.alttext-form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    margin-bottom: 8px;
}

.alttext-form-group__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.alttext-form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    color: #111827;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.alttext-form-group input::placeholder {
    color: #9ca3af;
}

.alttext-form-group input:focus {
    outline: none;
    border-color: #3A74FF;
    box-shadow: 0 0 0 3px rgba(58, 116, 255, 0.25);
}

.alttext-form-group input[readonly] {
    background-color: #f9fafb;
    cursor: not-allowed;
}

.alttext-form-group small {
    display: block;
    color: #6b7280;
    font-size: 13px;
    margin-top: 6px;
}

/* Forgot Password Link */
.alttext-forgot-password-link {
    color: #3A74FF;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.15s ease;
}

.alttext-forgot-password-link:hover {
    opacity: 0.7;
}

.alttext-forgot-password-info,
.alttext-reset-password-info {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Password Strength Indicator */
.alttext-password-strength {
    margin-top: 8px;
}

.alttext-password-strength-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.alttext-password-strength-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 4px;
}

.alttext-password-strength-label {
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

/* Primary Button - Blue */
.alttext-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    min-width: min(100%, 280px);
    max-width: 100%;
    padding: 0 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.15;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    width: auto;
    margin: 0 auto 12px;
    box-sizing: border-box;
}

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

.alttext-btn--primary {
    background: #3A74FF;
    color: #ffffff;
}

.alttext-btn--primary:hover:not(:disabled) {
    background: #2F5ED6;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.alttext-btn--primary:active:not(:disabled) {
    transform: scale(0.98);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}

.alttext-btn__spinner {
    margin-left: 8px;
}

/* Auth Switch Text */
.alttext-auth-switch {
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    margin: 0;
}

.alttext-auth-switch a {
    color: #3A74FF;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.15s ease;
}

.alttext-auth-switch a:hover {
    opacity: 0.7;
}

/* Alert Messages */
.alttext-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: alttext-alert-slide-in 0.3s ease-out;
}

@keyframes alttext-alert-slide-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alttext-alert--error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
}

.alttext-alert--success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

/* Footer Upsell Strip */
.alttext-auth-modal__footer {
    padding: 16px 44px 28px;
    text-align: center;
    border-top: 1px solid #e5e7eb;
}

.alttext-auth-modal__upsell {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 640px) {
    .alttext-auth-modal__overlay {
        padding: 12px;
    }

    .alttext-auth-modal__content {
        width: min(calc(100vw - 24px), 100%);
        max-height: calc(100vh - 24px);
    }
    
    .alttext-auth-modal__header {
        padding: 32px 24px 20px;
    }

    .alttext-auth-modal__body {
        padding: 0 24px 24px;
    }

    .alttext-auth-modal__value-step,
    .alttext-auth-modal__form-step {
        min-height: 0;
    }

    .alttext-auth-modal__footer {
        padding: 16px 24px 24px;
    }

    .alttext-auth-modal__title {
        font-size: 22px;
    }

    .alttext-auth-modal__subtitle {
        font-size: 13px;
    }

    .alttext-btn {
        width: 100%;
        min-width: 0;
        padding: 0 18px;
        font-size: 14px;
    }
}

#bbai-dashboard-main {
    transition: filter 240ms ease, transform 240ms ease;
}

body.bbai-auth-modal-open #bbai-dashboard-main {
    filter: blur(1.5px);
    transform: scale(0.98);
    transform-origin: center top;
}

@media (prefers-reduced-motion: reduce) {
    .alttext-auth-modal__overlay,
    .alttext-auth-modal__content {
        animation: none;
    }

    body.bbai-auth-modal-open #bbai-dashboard-main {
        transform: none;
    }
}
