/**
 * UCS Toast Notifications - Modern design matching AI Music Generator
 */

/* Container - Centered like Musiveo */
#ucs-toast-container {
    position: fixed !important;
    top: 80px; /* Position under typical header height */
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999999 !important; /* Higher than header */
    max-width: 400px;
    width: 90%;
    height: fit-content !important;
    pointer-events: none !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
}

/* Base Toast - Match Musiveo toast exactly */
.ucs-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%) scale(0.95);
    z-index: 9999999999 !important; /* Very high z-index to be above header */
    min-width: 320px;
    max-width: 420px;
    border-radius: 12px;
    border: 1px solid;
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: rgb(255, 255, 255);
}

/* Toast Types - Modern styling matching AI Music Generator */
.ucs-toast.reward,
.ucs-toast[data-type="reward"] {
    background: linear-gradient(135deg, rgba(31, 31, 31, 0.54), rgb(22 22 22 / 45%)) !important;
    border-color: rgb(40 40 40 / 45%) !important;
    color: rgb(255, 255, 255) !important;
}

.ucs-toast.success,
.ucs-toast[data-type="success"],
.ucs-toast.ucs-toast-success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border-color: #10b981 !important;
}

/* More specific rule for UCS success toast to avoid external CSS conflicts */
#ucs-toast-container .ucs-toast.success,
#ucs-toast-container .ucs-toast[data-type="success"],
#ucs-toast-container .ucs-toast.ucs-toast-success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border-color: #10b981 !important;
    height: auto !important;
    min-height: unset !important;
    max-height: none !important;
}

/* Override external .success::before rule that's adding large GIF animation */
#ucs-toast-container .ucs-toast.success::before,
#ucs-toast-container .ucs-toast[data-type="success"]::before,
#ucs-toast-container .ucs-toast.ucs-toast-success::before {
    content: none !important;
    display: none !important;
}

.ucs-toast.error,
.ucs-toast[data-type="error"],
.ucs-toast.ucs-toast-error {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    border-color: #ef4444 !important;
}

.ucs-toast.info,
.ucs-toast[data-type="info"],
.ucs-toast.ucs-toast-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    border-color: #3b82f6 !important;
}

.ucs-toast.credit,
.ucs-toast[data-type="credit"],
.ucs-toast.ucs-toast-credit {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%) !important;
    border: 1px solid rgba(139, 92, 246, 0.5) !important;
}

.ucs-toast.processing,
.ucs-toast[data-type="processing"],
.ucs-toast.ucs-toast-processing {
    background: linear-gradient(135deg, rgba(31, 31, 31, 0.54), rgb(22 22 22 / 45%)) !important;
    border-color: rgb(40 40 40 / 45%) !important;
}

.ucs-toast.ucs-toast-show {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
}

.ucs-toast.ucs-toast-hide {
    transform: translateX(-50%) translateY(-100%) scale(0.95);
    opacity: 0;
}

.ucs-balance, [data-ucs-balance] {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
}

.ucs-balance::before, [data-ucs-balance]::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm.31-8.86c-1.77-.45-2.34-.94-2.34-1.67 0-.84.79-1.43 2.1-1.43 1.38 0 1.9.66 1.94 1.64h1.71c-.05-1.34-.87-2.57-2.49-2.97V5H10.9v1.69c-1.51.32-2.72 1.3-2.72 2.81 0 1.97 1.31 2.96 3.55 3.51 1.77.46 2.34 1.15 2.34 1.87 0 .53-.39 1.39-2.1 1.39-1.6 0-2.23-.72-2.32-1.64H8.32c.1 1.7 1.36 2.66 2.86 2.97V19h2.34v-1.67c1.52-.29 2.72-1.16 2.73-2.77-.01-2.2-1.9-3.1-3.94-3.54z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

/* Toast Content - Match Musiveo layout */
.ucs-toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    position: relative;
}

/* Toast Icon */
.ucs-toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 0; /* Remove margin since gap handles spacing */
    color: #ffffff;
}

/* Toast Text */
.ucs-toast-text {
    flex: 1;
    min-width: 0;
}

/* Toast Title */
.ucs-toast-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 4px 0;
    color: #ffffff;
}

/* Toast Message */
.ucs-toast-message {
    font-size: 14px;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    word-break: break-word;
}

/* Toast Close Button */
.ucs-toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 6px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    opacity: 0.7;
    color: inherit;
    display: inline-flex;
    border-radius: 6px;
    transition: opacity 0.2s ease, background 0.2s ease;
    align-items: center;
    justify-content: center;
}

.ucs-toast-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

.ucs-toast-close:active {
    transform: scale(0.9);
}

/* Toast Progress Bar */
.ucs-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.2);
    width: 100%;
    transform-origin: left;
    border-radius: 0 0 12px 12px;
}

.ucs-toast-progress-animate {
    width: 100% !important;
}

.ucs-toast-success .ucs-toast-progress-animate {
    transition: width 3s linear;
}

.ucs-toast-error .ucs-toast-progress-animate {
    transition: width 5s linear;
}

.ucs-toast {
    pointer-events: auto !important;
}

/* Spin Animation for Processing */
@keyframes ucs-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ucs-toast-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: ucs-spin 1s linear infinite;
}

/* Toast Checkmark Animation */
.ucs-toast-checkmark {
    animation: ucsToastCheckmark 0.6s ease-out;
}

.ucs-toast-checkmark svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

@keyframes ucsToastCheckmark {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(-45deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Toast Error Animation */
.ucs-toast-error {
    animation: ucsToastError 0.5s ease-out;
}

.ucs-toast-error svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

@keyframes ucsToastError {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Diamond Icon for Credits */
.diamond-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    transform: rotate(45deg);
    margin-right: 6px;
    position: relative;
    top: -1px;
    flex-shrink: 0;
}

.diamond-icon:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 50%);
    border-radius: 2px;
}

/* Balance Update Animation */
@keyframes ucs-balance-update {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.ucs-balance-update {
    display: inline-block;
    animation: ucs-balance-update 0.5s ease-in-out;
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .ucs-toast {
        top: 15px;
        right: 15px;
        left: 15px;
        transform: translateY(-100%) scale(0.95);
        min-width: unset;
        max-width: unset;
    }
    
    .ucs-toast.ucs-toast-show {
        transform: translateY(0) scale(1);
    }
    
    .ucs-toast.ucs-toast-hide {
        transform: translateY(-100%) scale(0.95);
    }
    
    .ucs-toast-content {
        padding: 14px 16px;
    }
    
    .ucs-toast-title {
        font-size: 15px;
    }
    
    .ucs-toast-message {
        font-size: 13px;
    }
}
