/* ============================================
   TOASTR — Pill style (country card polish)
   ============================================ */

:root {
    --toast-pill-radius: 999px;
    --toast-font: var(--font-main, 'Outfit', system-ui, sans-serif);
    --toast-shadow: 0 4px 18px rgba(15, 39, 71, 0.1), 0 1px 4px rgba(15, 39, 71, 0.06);

    --toast-success-color: #22a06b;
    --toast-success-border: #b7e4c7;
    --toast-success-icon: #22a06b;

    --toast-info-color: #1d7afc;
    --toast-info-border: #b6d4fe;
    --toast-info-icon: #1d7afc;

    --toast-warning-color: #e56910;
    --toast-warning-border: #ffd8a8;
    --toast-warning-icon: #e56910;

    --toast-error-color: #e2483d;
    --toast-error-border: #f5c2c7;
    --toast-error-icon: #e2483d;
}

/* Container */
#toast-container {
    top: calc(var(--topbar-height, 60px) + 14px);
    right: 18px;
    z-index: 99999;
    pointer-events: none;
}

#toast-container > div {
    pointer-events: auto;
    width: auto;
    min-width: 280px;
    max-width: min(420px, calc(100vw - 36px));
    opacity: 1;
    padding: 0;
    overflow: hidden;
    background-image: none !important;
    font-family: var(--toast-font);
    border-radius: var(--toast-pill-radius);
    box-shadow: var(--toast-shadow);
    animation: toastPillIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    transform-origin: top right;
}

#toast-container > div:hover {
    box-shadow: 0 8px 24px rgba(15, 39, 71, 0.14), 0 2px 8px rgba(15, 39, 71, 0.08);
}

/* Base pill */
#toast-container > .toast {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 10px 42px 12px 14px;
    background: #ffffff !important;
    border-radius: var(--toast-pill-radius);
    border: 1.5px solid #e8eaed;
    color: var(--text-color, #1a2332);
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

#toast-container > .toast::before,
#toast-container > .toast::after {
    content: none;
    display: none;
}

/* Icon — injected via background on left padding area using box model trick */
#toast-container > .toast {
    padding-left: 56px;
}

#toast-container > .toast .toast-message {
    position: relative;
}

#toast-container > .toast .toast-message::before {
    content: '';
    position: absolute;
    left: -46px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 15px 15px;
    flex-shrink: 0;
}

/* Hide title — single-line pill message like reference */
#toast-container .toast-title {
    display: none !important;
}

#toast-container .toast-message {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.4;
    letter-spacing: 0.01em;
    margin: 0;
    padding: 0;
    word-break: break-word;
}

#toast-container .toast-message a,
#toast-container .toast-message label {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

/* Close button */
#toast-container button.toast-close-button {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #9aa5b4;
    font-size: 17px;
    font-weight: 400;
    line-height: 1;
    opacity: 1;
    transition: color 0.2s ease, background 0.2s ease;
}

#toast-container button.toast-close-button:hover,
#toast-container button.toast-close-button:focus {
    color: #5f6b7c;
    background: rgba(15, 39, 71, 0.05);
    outline: none;
}

/* Progress bar — contained inside pill; toastr animates width inline */
#toast-container .toast-progress {
    position: absolute;
    left: 0;
    right: auto;
    bottom: 0;
    top: auto;
    height: 3px;
    max-width: 100%;
    margin: 0;
    padding: 0;
    opacity: 0.4;
    border-radius: 0;
    box-sizing: border-box;
    transform: none;
}

/* ── Success ── */
#toast-container > .toast-success {
    border-color: var(--toast-success-border) !important;
    color: var(--toast-success-color) !important;
}

#toast-container > .toast-success .toast-message::before {
    background-color: var(--toast-success-icon);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}

#toast-container > .toast-success .toast-progress {
    background-color: var(--toast-success-color) !important;
}

/* ── Error ── */
#toast-container > .toast-error {
    border-color: var(--toast-error-border) !important;
    color: var(--toast-error-color) !important;
}

#toast-container > .toast-error .toast-message::before {
    background-color: var(--toast-error-icon);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='8' x2='12' y2='13'/%3E%3Ccircle cx='12' cy='16.5' r='1' fill='white' stroke='none'/%3E%3C/svg%3E");
    animation: toastIconPop 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

#toast-container > .toast-error .toast-progress {
    background-color: var(--toast-error-color) !important;
}

/* ── Warning (triangle icon) ── */
#toast-container > .toast-warning {
    border-color: var(--toast-warning-border) !important;
    color: var(--toast-warning-color) !important;
}

#toast-container > .toast-warning .toast-message::before {
    width: 32px;
    height: 32px;
    left: -48px;
    border-radius: 0;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='%23e56910' d='M16 3L30 28H2L16 3z'/%3E%3Cline x1='16' y1='12' x2='16' y2='19' stroke='white' stroke-width='2.5' stroke-linecap='round'/%3E%3Ccircle cx='16' cy='23' r='1.4' fill='white'/%3E%3C/svg%3E");
    background-size: 32px 32px;
}

#toast-container > .toast-warning .toast-progress {
    background-color: var(--toast-warning-color) !important;
}

/* ── Info ── */
#toast-container > .toast-info {
    border-color: var(--toast-info-border) !important;
    color: var(--toast-info-color) !important;
}

#toast-container > .toast-info .toast-message::before {
    background-color: var(--toast-info-icon);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='16' x2='12' y2='11'/%3E%3Ccircle cx='12' cy='8' r='1.2' fill='white' stroke='none'/%3E%3C/svg%3E");
}

#toast-container > .toast-info .toast-progress {
    background-color: var(--toast-info-color) !important;
}

/* ── Animations ── */
@keyframes toastPillIn {
    0% {
        opacity: 0;
        transform: translateX(105%) scale(0.96);
    }
    65% {
        transform: translateX(-3px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastIconPop {
    0% {
        transform: translateY(-50%) scale(0.6);
        opacity: 0;
    }
    70% {
        transform: translateY(-50%) scale(1.08);
    }
    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}

#toast-container > div:nth-child(1) { animation-delay: 0s; }
#toast-container > div:nth-child(2) { animation-delay: 0.06s; }
#toast-container > div:nth-child(3) { animation-delay: 0.12s; }

/* Mobile */
@media (max-width: 575.98px) {
    #toast-container {
        left: 12px;
        right: 12px;
    }

    #toast-container > div {
        min-width: 0;
        max-width: none;
        width: 100%;
    }
}
