@use "../variable" as *;

.rbfb-alert-overlay {
    --alert-primary: var(--rbfb-primary);
    --alert-success: var(--rbfb-success);
    --alert-error: var(--rbfb-error);
    --alert-warning: var(--rbfb-warning);
    --alert-info: var(--rbfb-primary);
    --alert-info-hover: var(--rbfb-primary-hover);
    --alert-question: var(--rbfb-primary);
    --alert-overlay-light: rgba(0, 0, 0, 0.5);
    --alert-overlay-dark: rgba(0, 0, 0, 0.7);
    --alert-border-radius: 12px;
    --alert-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.rbfb-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--alert-overlay-light);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    animation: rbfb-alert-fade-in 0.3s ease-out;
}

// .rbfb-alert-overlay.dark {
//     background: var(--alert-overlay-dark);
// }

.rbfb-alert-overlay.rbfb-toast {
    background: transparent;
    pointer-events: none;
    align-items: flex-start;
    justify-content: center;
    padding: var(--rbfb-space-5);
    z-index: 99999999;
}

.rbfb-alert-overlay.rbfb-toast .rbfb-alert-container {
    pointer-events: all;
}

.rbfb-alert-container {
    background: $white;
    color: $black;
    border-radius: var(--alert-border-radius);
    box-shadow: var(--alert-shadow);
    padding: var(--rbfb-space-5);
    max-width: 500px;
    width: 90%;
    animation: rbfb-alert-slide-in 0.3s ease-out;
    position: relative;
    overflow: visible;
    scrollbar-width: none;
}

// .rbfb-alert-container.dark {
//     background: $black;
//     color: $black;
// }

.rbfb-alert-container.rbfb-toast {
    max-width: 350px;
    width: fit-content;
    padding: 5px;
    border-radius: 6px;
    padding-right: 25px;
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.1),
        0 3px 3px rgba(0, 0, 0, 0.05);
    animation: rbfb-alert-slide-in-toast 0.4s
        cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.rbfb-alert-container.closing {
    animation: rbfb-alert-slide-out 0.2s ease-in;
}

.rbfb-alert-container.toast-closing {
    animation: rbfb-alert-slide-out-toast 0.3s ease-in;
}

.top-left {
    align-items: flex-start;
    justify-content: flex-start;
}

.top-center {
    align-items: flex-start;
    justify-content: center;
}
.center-center {
    align-items: center;
    justify-content: center;
}

.top-right {
    align-items: flex-start;
    justify-content: flex-end;
}

.bottom-left {
    align-items: flex-end;
    justify-content: flex-start;
}

.bottom-center {
    align-items: flex-end;
    justify-content: center;
}

.bottom-right {
    align-items: flex-end;
    justify-content: flex-end;
}

.rbfb-alert-icon-container {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rbfb-alert-scale-in 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.rbfb-alert-icon-container.rbfb-toast {
    width: 40px;
    height: 40px;
    margin: 0;
    border-radius: 50%;
    flex-shrink: 0;
    border: none;
}

.rbfb-alert-icon-container svg {
    width: 40px;
    height: 40px;
}

.rbfb-alert-icon-container.rbfb-toast svg {
    width: 24px;
    height: 24px;
}

.rbfb-alert-icon-container.rbfb-success {
    color: var(--alert-success);
    border: 1px solid $success-50;
}

.rbfb-alert-icon-container.rbfb-error {
    color: var(--alert-error);
    border: 1px solid $error-50;
}

.rbfb-alert-icon-container.rbfb-warning {
    color: var(--alert-warning);
    border: 1px solid $warning-50;
}

.rbfb-alert-icon-container.rbfb-info {
    color: var(--alert-info);
    border: 1px solid $info-50;
}

.rbfb-alert-icon-container.rbfb-question {
    color: var(--alert-question);
    border: 1px solid $primary-extralight;
}

.rbfb-alert-toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: var(--rbfb-space-1);
}

.rbfb-alert-toast-text {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.rbfb-alert-content {
    text-align: left;
}

.rbfb-alert-title {
    font-size: 24px;
    font-weight: 500;
    margin: 0 0 var(--rbfb-space-2) 0;
    line-height: 1.3;
    color: $black;
}

.rbfb-alert-title.rbfb-toast {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 var(--rbfb-space-1) 0;
}

.rbfb-alert-message {
    font-size: 14px;
    line-height: 1.6;
    opacity: 0.8;
    margin: 0;
    color: $gray-800;
}

.rbfb-alert-html-content * {
    max-width: 100%;
}

.rbfb-alert-input-container {
    margin: var(--rbfb-space-6) 0 0 0;
}

.rbfb-alert-input {
    width: 100%;
    padding: 3px var(--rbfb-space-3) !important;
    border-radius: 3px !important;
    border: 1px solid var(--rbfb-secondary) !important;
    font-size: 15px;
    transition: all 0.2s;
    background: transparent;
    color: inherit;
    font-family: inherit;
}

.rbfb-alert-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

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

// .rbfb-alert-input.dark {
//     border-color: #374151;
// }

// .rbfb-alert-input.dark:focus {
//     border-color: var(--alert-primary);
// }

.rbfb-alert-textarea {
    resize: vertical;
    min-height: 100px;
}

.rbfb-alert-error-text {
    color: var(--alert-error);
    font-size: 14px;
    margin-top: var(--rbfb-space-2);
    text-align: left;
}

.rbfb-alert-buttons {
    display: flex;
    gap: var(--rbfb-space-3);
    margin-top: var(--rbfb-space-5);
    justify-content: end;
}

.rbfb-alert-buttons.rbfb-toast {
    margin-top: var(--rbfb-space-3);
}

.rbfb-alert-button {
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 400;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rbfb-alert-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.rbfb-alert-button.rbfb-toast {
    padding: 6px var(--rbfb-space-4);
    font-size: 14px;
    min-width: auto;
}

.rbfb-alert-confirm-button {
    background: var(--alert-primary);
    color: white;
}

.rbfb-alert-confirm-button:hover:not(:disabled) {
    background: var(--rbfb-primary-hover);
}

.rbfb-alert-confirm-button.success {
    background: var(--alert-success);
}

.rbfb-alert-confirm-button.success:hover:not(:disabled) {
    background: rgba(0, 172, 71, 0.8);
}

.rbfb-alert-confirm-button.error {
    background: var(--alert-error);
}

.rbfb-alert-confirm-button.error:hover:not(:disabled) {
    background: rgba(255, 0, 0, 0.8);
}

.rbfb-alert-confirm-button.warning {
    background: var(--alert-warning);
}

.rbfb-alert-confirm-button.warning:hover:not(:disabled) {
    background: rgba(255, 89, 0, 0.8);
}

.rbfb-alert-confirm-button.info {
    background: var(--alert-info);
}

.rbfb-alert-confirm-button.info:hover:not(:disabled) {
    background: var(--alert-info-hover);
}

.rbfb-alert-confirm-button.question {
    background: var(--alert-question);
}

.rbfb-alert-confirm-button.question:hover:not(:disabled) {
    background: rgba(11, 153, 110, 0.8);
}

.rbfb-alert-cancel-button {
    background: $error-100;
    color: black;
}

.rbfb-alert-cancel-button:hover {
    background: rgba(255, 0, 0, 0.3);
}

// .rbfb-alert-cancel-button.dark:hover {
//     background: #4b5563;
// }

.rbfb-alert-close-button {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: all 0.2s;
    color: inherit;
}

.rbfb-alert-close-button:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

// .rbfb-alert-close-button.dark:hover {
//     background: rgba(255, 255, 255, 0.1);
// }

.rbfb-alert-close-button svg {
    width: 20px;
    height: 20px;
}

.rbfb-alert-timer-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--alert-primary);
    border-radius: 0 0 0 var(--alert-border-radius);
}

.rbfb-alert-timer-progress.rbfb-progress-success {
    background: var(--alert-success);
}

.rbfb-alert-timer-progress.rbfb-progress-error {
    background: var(--alert-error);
}

.rbfb-alert-timer-progress.rbfb-progress-warning {
    background: var(--alert-warning);
}

.rbfb-alert-timer-progress.rbfb-progress-info {
    background: var(--alert-info);
}

.rbfb-alert-timer-progress.rbfb-progress-question {
    background: var(--alert-question);
}

.rbfb-alert-spinner {
    display: block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: rbfb-alert-spin 0.8s linear infinite;
    margin-right: var(--rbfb-space-2);
}

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

@keyframes rbfb-alert-slide-in {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes rbfb-alert-slide-out {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
}

@keyframes rbfb-alert-slide-in-toast {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rbfb-alert-slide-out-toast {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

@keyframes rbfb-alert-scale-in {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

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

@keyframes rbfb-alert-timer-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

.rbfb-toast-tray {
    position: fixed;
    z-index: 99999999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: var(--rbfb-space-5);
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
}

.rbfb-toast-tray.top-left {
    top: 0;
    left: 0;
    padding-left: var(--rbfb-space-5);
    align-items: flex-start;
}

.rbfb-toast-tray.top-center {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
}

.rbfb-toast-tray.top-right {
    top: 0;
    right: 0;
    padding-right: var(--rbfb-space-5);
    align-items: flex-end;
}

.rbfb-toast-tray.center-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    align-items: center;
    justify-content: center;
}

.rbfb-toast-tray.bottom-left {
    bottom: 0;
    left: 0;
    flex-direction: column-reverse;
    align-items: flex-start;
    padding-left: var(--rbfb-space-5);
    padding-bottom: var(--rbfb-space-5);
}

.rbfb-toast-tray.bottom-center {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: column-reverse;
    align-items: center;
    padding-bottom: var(--rbfb-space-5);
}

.rbfb-toast-tray.bottom-right {
    bottom: 0;
    right: 0;
    flex-direction: column-reverse;
    align-items: flex-end;
    padding-right: var(--rbfb-space-5);
    padding-bottom: var(--rbfb-space-5);
}

.rbfb-alert-overlay.rbfb-toast.rbfb-toast-in-tray {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    height: auto;
    background: transparent;
    pointer-events: auto;
    padding: 0;
    animation: none;
    flex: none;
    display: block;
}

.rbfb-alert-overlay.rbfb-toast.rbfb-toast-in-tray .rbfb-alert-container {
    pointer-events: all;
}
