/**
 * نظام Toast Notifications المحسّن - نادي أدِيب
 * متوافق مع هوية النادي وتصميمات الأزرار والحقول
 */

:root {
    /* ألوان نادي أدِيب */
    --main-blue: #274060;
    --accent-blue: #3d8fd6;
    --light-blue: #6ba8e2;
    --dark-blue: #1a2a3a;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --purple-color: #8b5cf6;
    
    /* تأثيرات متوافقة مع التصميمات الأخرى */
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-blue: 0 4px 20px rgba(61, 143, 214, 0.25);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* حاوية الإشعارات - من الجهة اليمنى */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
    max-width: 380px;
    width: auto;
}

/* Toast الأساسي - تصميم جديد */
.toast {
    background: linear-gradient(135deg, #ffffff, #f8fbff);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    pointer-events: auto;
    animation: toastSlideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transition: var(--transition);
    border-right: 4px solid var(--accent-blue);
    position: relative;
    overflow: hidden;
    min-width: 300px;
    border: 1px solid rgba(61, 143, 214, 0.15);
}

.toast.hiding {
    animation: toastSlideOutRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* تأثير الشريط المتحرك */
.toast::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent);
    transition: left 0.7s ease;
    z-index: 1;
    pointer-events: none;
}

.toast:hover::before {
    left: 100%;
}

/* أيقونة Toast */
.toast-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    background: rgba(61, 143, 214, 0.12);
    border-radius: 10px;
    color: var(--accent-blue);
}

/* محتوى Toast */
.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--main-blue);
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.toast-message {
    font-size: 0.875rem;
    color: #335c81;
    margin: 0;
    line-height: 1.4;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* زر الإغلاق - تمت إزالته حسب الطلب */
/* .toast-close تمت إزالته */

/* شريط التقدم */
.toast-progress {
    position: absolute;
    bottom: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, currentColor);
    opacity: 0.5;
    animation: toastProgress linear forwards;
}

/* أنواع Toast - بتصميم متناغم */

/* Success */
.toast.toast-success {
    border-right-color: var(--success-color);
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.toast.toast-success .toast-icon {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.12);
}

.toast.toast-success .toast-progress {
    background: linear-gradient(90deg, transparent, var(--success-color));
}

/* Error */
.toast.toast-error {
    border-right-color: var(--error-color);
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
}

.toast.toast-error .toast-icon {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.12);
}

.toast.toast-error .toast-progress {
    background: linear-gradient(90deg, transparent, var(--error-color));
}

/* Warning */
.toast.toast-warning {
    border-right-color: var(--warning-color);
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
}

.toast.toast-warning .toast-icon {
    color: var(--warning-color);
    background: rgba(245, 158, 11, 0.12);
}

.toast.toast-warning .toast-progress {
    background: linear-gradient(90deg, transparent, var(--warning-color));
}

/* Info */
.toast.toast-info {
    border-right-color: var(--info-color);
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.toast.toast-info .toast-icon {
    color: var(--info-color);
    background: rgba(59, 130, 246, 0.12);
}

.toast.toast-info .toast-progress {
    background: linear-gradient(90deg, transparent, var(--info-color));
}

/* Loading */
.toast.toast-loading {
    border-right-color: var(--purple-color);
    background: linear-gradient(135deg, #faf5ff, #f3e8ff);
}

.toast.toast-loading .toast-icon {
    color: var(--purple-color);
    background: rgba(139, 92, 246, 0.12);
}

.toast.toast-loading .toast-icon i {
    animation: spin 1s linear infinite;
}

/* أنيميشنات جديدة */
@keyframes toastSlideInRight {
    from {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes toastSlideOutRight {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
}

@keyframes toastProgress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* تأثيرات Hover */
.toast:hover {
    transform: translateX(-5px) scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

/* Toast مع أزرار إجراءات - متوافق مع تصميم الأزرار */
.toast-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.toast-action-btn {
    padding: 0.375rem 0.875rem;
    border: none;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.toast-action-btn.primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--main-blue));
    color: white;
    box-shadow: var(--shadow-blue);
}

.toast-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(61, 143, 214, 0.4);
}

.toast-action-btn.secondary {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: var(--main-blue);
    border: 1px solid rgba(61, 143, 214, 0.2);
}

.toast-action-btn.secondary:hover {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    transform: translateY(-2px);
}

/* Toast مع صورة */
.toast.toast-with-image {
    padding-left: 0.75rem;
}

.toast-image {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(61, 143, 214, 0.2);
}

/* Toast مجمّع */
.toast.toast-group {
    cursor: pointer;
    border-style: dashed;
}

.toast-group-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 0.5rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--main-blue));
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* حالات خاصة */
.toast.toast-persistent {
    border-right-width: 6px;
    animation: toastPulse 2s infinite;
}

.toast.toast-persistent .toast-progress {
    display: none;
}

@keyframes toastPulse {
    0%, 100% {
        box-shadow: var(--shadow-lg);
    }
    50% {
        box-shadow: 0 8px 28px rgba(61, 143, 214, 0.35);
    }
}

/* تنسيقات متجاوبة */
@media (max-width: 768px) {
    .toast-container {
        top: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
        max-width: none;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
        padding: 0.875rem 1rem;
    }
    
    .toast-title {
        font-size: 0.9rem;
    }
    
    .toast-message {
        font-size: 0.8125rem;
    }
}

/* وضع الموبايل - من الأسفل */
@media (max-width: 640px) {
    .toast-container.mobile-bottom {
        top: auto;
        bottom: 1rem;
        right: 0.5rem;
        left: 0.5rem;
    }
    
    .toast-container.mobile-bottom .toast {
        animation: toastSlideInBottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    
    .toast-container.mobile-bottom .toast.hiding {
        animation: toastSlideOutBottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }
}

@keyframes toastSlideInBottom {
    from {
        transform: translateY(100%) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes toastSlideOutBottom {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateY(100%) scale(0.95);
        opacity: 0;
    }
}

/* Dark mode support - متوافق مع هوية أدِيب */
@media (prefers-color-scheme: dark) {
    .toast {
        background: linear-gradient(135deg, #1e293b, #0f172a);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
        border-color: rgba(61, 143, 214, 0.3);
    }
    
    .toast-title {
        color: #e2e8f0;
    }
    
    .toast-message {
        color: #94a3b8;
    }
    
    .toast-icon {
        background: rgba(61, 143, 214, 0.2);
    }
    
    /* Success في الوضع الداكن */
    .toast.toast-success {
        background: linear-gradient(135deg, #064e3b, #022c22);
    }
    
    /* Error في الوضع الداكن */
    .toast.toast-error {
        background: linear-gradient(135deg, #7f1d1d, #450a0a);
    }
    
    /* Warning في الوضع الداكن */
    .toast.toast-warning {
        background: linear-gradient(135deg, #78350f, #451a03);
    }
    
    /* Info في الوضع الداكن */
    .toast.toast-info {
        background: linear-gradient(135deg, #1e3a8a, #172554);
    }
    
    /* Loading في الوضع الداكن */
    .toast.toast-loading {
        background: linear-gradient(135deg, #4c1d95, #2e1065);
    }
    
    .toast-action-btn.secondary {
        background: linear-gradient(135deg, #334155, #1e293b);
        color: #e2e8f0;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .toast-action-btn.secondary:hover {
        background: linear-gradient(135deg, #475569, #334155);
    }
}