/* Marjaa global flash toast (glass pill + progress) */

.marjaa-toast {
    --marjaa-toast-duration: 5s;

    position: fixed;
    z-index: 1090;
    top: calc(env(safe-area-inset-top, 0px) + 7rem);
    right: max(1rem, env(safe-area-inset-right, 0px));
    left: auto;
    bottom: auto;
    transform: translate3d(calc(100% + 1.5rem), 0, 0);
    opacity: 0;
    transition:
        opacity 0.22s ease,
        transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    max-width: min(calc(100vw - 2rem), 440px);
    min-width: min(calc(100vw - 2rem), 280px);
    width: max-content;
    pointer-events: none;
}

.marjaa-toast--show {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.marjaa-toast-surface {
    font-family: var(--font-app, 'The Year of Handicrafts', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    position: relative;
    overflow: hidden;
    background: rgba(15, 20, 34, 0.82);
    background-image: linear-gradient(
        135deg,
        rgba(33, 150, 243, 0.22) 0%,
        rgba(13, 71, 161, 0.14) 45%,
        rgba(10, 14, 39, 0.5) 100%
    );
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    padding: 0.85rem 1.15rem 0;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(33, 150, 243, 0.12),
        0 0 48px rgba(33, 150, 243, 0.18);
}

.marjaa-toast-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.85rem;
    direction: ltr;
}

.marjaa-toast-text {
    margin: 0;
    flex: 0 1 auto;
    min-width: 0;
    order: 1;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.96);
    text-align: start;
}

.marjaa-toast-badge {
    position: relative;
    flex-shrink: 0;
    order: 2;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 50%;
    background: #43a047;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    font-size: 0.95rem;
    box-shadow: 0 0 16px rgba(67, 160, 71, 0.55);
}

.marjaa-toast-badge i {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    line-height: 1;
    margin: 0 !important; /* rtl.css adds .fas margins in Arabic; breaks centering + spacing */
    padding: 0;
    width: 1em;
    height: 1em;
    font-size: 0.88rem;
    text-align: center;
    transform: translate(-50%, -50%);
}

.marjaa-toast--error .marjaa-toast-badge {
    background: #e53935;
    box-shadow: 0 0 16px rgba(229, 57, 53, 0.45);
}

.marjaa-toast--info .marjaa-toast-badge {
    background: #1e88e5;
    box-shadow: 0 0 16px rgba(30, 136, 229, 0.45);
}

.marjaa-toast--warning .marjaa-toast-badge {
    background: #fb8c00;
    box-shadow: 0 0 16px rgba(251, 140, 0, 0.45);
}

.marjaa-toast-progress {
    margin: 0.7rem -1.15rem 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 0 0 999px 999px;
    overflow: hidden;
    direction: ltr;
}

.marjaa-toast-progress-bar {
    display: block;
    height: 100%;
    width: 100%;
    transform: scaleX(1);
    transform-origin: right center;
    background: #66bb6a;
}

.marjaa-toast--error .marjaa-toast-progress-bar {
    background: #ff7043;
}

.marjaa-toast--info .marjaa-toast-progress-bar {
    background: #42a5f5;
}

.marjaa-toast--warning .marjaa-toast-progress-bar {
    background: #ffb74d;
}

.marjaa-toast--show .marjaa-toast-progress-bar {
    animation: marjaaToastProgress linear forwards;
    animation-duration: var(--marjaa-toast-duration, 5s);
}

@keyframes marjaaToastProgress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* Processing / uploading toast */
.marjaa-toast--processing .marjaa-toast-badge {
    background: #1e88e5;
    box-shadow: 0 0 16px rgba(30, 136, 229, 0.45);
}

.marjaa-toast-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    line-height: 1;
    margin: 0 !important;
    padding: 0;
    width: 1em;
    height: 1em;
    font-size: 0.9rem;
    text-align: center;
    transform: translate(-50%, -50%);
    animation: marjaaSpinner 0.85s linear infinite;
}

@keyframes marjaaSpinner {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Override the shrink animation inside a processing toast — shimmer must win */
.marjaa-toast--processing.marjaa-toast--show .marjaa-toast-progress-bar,
.marjaa-toast--processing .marjaa-toast-progress-bar {
    animation: marjaaShimmer 1.4s ease-in-out infinite !important;
    background: #42a5f5;
    width: 40%;
    transform: none;
    transform-origin: left center;
}

@keyframes marjaaShimmer {
    0%   { margin-left: 0;   }
    50%  { margin-left: 60%; }
    100% { margin-left: 0;   }
}
