/**
 * RivaToast - Unified Toast Notification System
 * Apple-inspired toast notifications
 *
 * @package RivaClientPortal
 * @version 1.0.0
 */

/* Toast Container */
.riva-toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 400px;
}

/* Mobile: Center bottom */
@media (max-width: 768px) {
    .riva-toast-container {
        top: auto;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
        left: 16px;
        right: 16px;
        max-width: none;
    }
}

/* Toast Item */
.riva-toast {
    background: rgba(28, 28, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.1);
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    pointer-events: auto;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 300px;
    max-width: 400px;
}

@media (max-width: 768px) {
    .riva-toast {
        min-width: 0;
        max-width: none;
        transform: translateY(100px);
    }
}

/* Toast Visible State */
.riva-toast.riva-toast--visible {
    transform: translateX(0);
    opacity: 1;
}

@media (max-width: 768px) {
    .riva-toast.riva-toast--visible {
        transform: translateY(0);
    }
}

/* Toast Types */
.riva-toast--success {
    border-left: 4px solid #30d158;
}

.riva-toast--error {
    border-left: 4px solid #ff3b30;
}

.riva-toast--warning {
    border-left: 4px solid #ff9500;
}

.riva-toast--info {
    border-left: 4px solid #0a84ff;
}

/* Toast Content */
.riva-toast__content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.riva-toast__icon {
    flex-shrink: 0;
    font-size: 20px;
    line-height: 1;
}

.riva-toast__body {
    flex: 1;
    min-width: 0;
}

.riva-toast__message {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    margin: 0;
}

.riva-toast__actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.riva-toast__action {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.riva-toast__action:hover {
    background: rgba(255, 255, 255, 0.25);
}

.riva-toast__action--primary {
    background: #0a84ff;
}

.riva-toast__action--primary:hover {
    background: #0077ed;
}

.riva-toast__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.riva-toast__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

/* Progress Toast Styles */
.riva-toast--progress .riva-toast__body {
    padding-right: 0;
}

.riva-toast__progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
}

.riva-toast__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0a84ff 0%, #0077ed 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.riva-toast__progress-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 600;
    margin: 8px 0 0 0;
    text-align: right;
}

/* Spinner Animation */
.riva-toast__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #0a84ff;
    border-radius: 50%;
    animation: riva-toast-spin 0.8s linear infinite;
}

@keyframes riva-toast-spin {
    to { transform: rotate(360deg); }
}

/* Progress Bar */
.riva-toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0 0 14px 14px;
    overflow: hidden;
}

.riva-toast__progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #0a84ff, #5ac8fa);
    width: 100%;
    transform-origin: left;
    animation: toast-progress linear forwards;
}

.riva-toast--success .riva-toast__progress-bar {
    background: linear-gradient(90deg, #30d158, #32d74b);
}

.riva-toast--error .riva-toast__progress-bar {
    background: linear-gradient(90deg, #ff3b30, #ff453a);
}

.riva-toast--warning .riva-toast__progress-bar {
    background: linear-gradient(90deg, #ff9500, #ffcc00);
}

@keyframes toast-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .riva-toast {
        transition: none;
    }
    
    .riva-toast__progress-bar {
        animation: none;
    }
}

/* Hide WP admin notices on Riva pages */
.riva-portal-page .notice,
.riva-portal-page .error,
.riva-portal-page .updated {
    display: none !important;
}

