/**
 * تصميم Toast للرسائل التنبيهية
 * Toast Notification Styles
 */

/* الحاوية الأساسية */
.toast-notification {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.75rem;
    background: #ffffff;
    color: #1e293b;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 16px 48px rgba(0, 0, 0, 0.08);
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    z-index: 10000;
    min-width: 320px;
    max-width: 450px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

/* تحسينات للهواتف */
@media (max-width: 768px) {
    .toast-notification {
        min-width: 280px;
        max-width: calc(100vw - 32px);
        padding: 0.9rem 1.2rem;
        font-size: 0.875rem;
        border-radius: 12px;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .toast-notification {
        min-width: 260px;
        max-width: calc(100vw - 24px);
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
        border-radius: 10px;
        gap: 0.6rem;
    }
}

/* المواضع المختلفة */
.toast-top-right {
    top: 20px;
    right: 20px;
}

.toast-top-left {
    top: 20px;
    left: 20px;
    transform: translateX(-100%);
}

.toast-bottom-right {
    bottom: 20px;
    right: 20px;
}

.toast-bottom-left {
    bottom: 20px;
    left: 20px;
    transform: translateX(-100%);
}

.toast-top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
}

.toast-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
}

/* تحسين المواضع للهواتف */
@media (max-width: 768px) {
    .toast-top-right,
    .toast-top-left,
    .toast-top-center {
        top: 16px;
    }
    
    .toast-bottom-right,
    .toast-bottom-left,
    .toast-bottom-center {
        bottom: 16px;
    }
}

@media (max-width: 480px) {
    .toast-top-right,
    .toast-top-left,
    .toast-top-center {
        top: 12px;
    }
    
    .toast-bottom-right,
    .toast-bottom-left,
    .toast-bottom-center {
        bottom: 12px;
    }
    
    .toast-top-right {
        right: 12px;
    }
    
    .toast-top-left {
        left: 12px;
    }
    
    .toast-bottom-right {
        right: 12px;
    }
    
    .toast-bottom-left {
        left: 12px;
    }
}

/* حالة الظهور */
.toast-show {
    opacity: 1;
    transform: translateX(0) translateY(0) !important;
}

.toast-show.toast-top-center,
.toast-show.toast-bottom-center {
    transform: translateX(-50%) translateY(0) !important;
}

/* حالة الاختفاء */
.toast-hide {
    opacity: 0;
}

.toast-hide.toast-top-right,
.toast-hide.toast-bottom-right {
    transform: translateX(100%);
}

.toast-hide.toast-top-left,
.toast-hide.toast-bottom-left {
    transform: translateX(-100%);
}

.toast-hide.toast-top-center {
    transform: translateX(-50%) translateY(-100%);
}

.toast-hide.toast-bottom-center {
    transform: translateX(-50%) translateY(100%);
}

/* الأنواع المختلفة */
.toast-success {
    background: linear-gradient(135deg, #ffffff 0%, #fef9f5 100%);
    border: 3px solid #2da854;
    border-right: 8px solid #2da854;
    color: #1e293b;
    box-shadow: 0 8px 24px rgba(45, 168, 84, 0.15), 0 16px 48px rgba(45, 168, 84, 0.1);
}

.toast-success .toast-icon {
    color: #2da854;
}

.toast-success .toast-message {
    color: #1e293b;
}

.toast-success .toast-close {
    color: #64748b;
}

.toast-success .toast-close:hover {
    background: rgba(45, 168, 84, 0.1);
    color: #2da854;
}

.toast-error {
    background: linear-gradient(135deg, #ffffff 0%, #fef9f5 100%);
    border: 3px solid #e32e21;
    border-right: 8px solid #e32e21;
    color: #1e293b;
    box-shadow: 0 8px 24px rgba(227, 46, 33, 0.15), 0 16px 48px rgba(227, 46, 33, 0.1);
}

.toast-error .toast-icon {
    color: #e32e21;
}

.toast-error .toast-message {
    color: #1e293b;
}

.toast-error .toast-close {
    color: #64748b;
}

.toast-error .toast-close:hover {
    background: rgba(227, 46, 33, 0.1);
    color: #e32e21;
}

.toast-info {
    background: linear-gradient(135deg, #ffffff 0%, #fef9f5 100%);
    border: 3px solid #3490dc;
    border-right: 8px solid #3490dc;
    color: #1e293b;
    box-shadow: 0 8px 24px rgba(52, 144, 220, 0.15), 0 16px 48px rgba(52, 144, 220, 0.1);
}

.toast-info .toast-icon {
    color: #3490dc;
}

.toast-info .toast-message {
    color: #1e293b;
}

.toast-info .toast-close {
    color: #64748b;
}

.toast-info .toast-close:hover {
    background: rgba(52, 144, 220, 0.1);
    color: #3490dc;
}

.toast-warning {
    background: linear-gradient(135deg, #ffffff 0%, #fef9f5 100%);
    border: 3px solid #f5a623;
    border-right: 8px solid #f5a623;
    color: #1e293b;
    box-shadow: 0 8px 24px rgba(245, 166, 35, 0.15), 0 16px 48px rgba(245, 166, 35, 0.1);
}

.toast-warning .toast-icon {
    color: #f5a623;
}

.toast-warning .toast-message {
    color: #1e293b;
}

.toast-warning .toast-close {
    color: #64748b;
}

.toast-warning .toast-close:hover {
    background: rgba(245, 166, 35, 0.1);
    color: #f5a623;
}

/* الأيقونة */
.toast-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@media (max-width: 768px) {
    .toast-icon {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .toast-icon {
        font-size: 1.35rem;
    }
}

/* النص */
.toast-message {
    flex: 1;
    line-height: 1.6;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .toast-message {
        font-weight: 600;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    .toast-message {
        font-weight: 600;
        line-height: 1.4;
        letter-spacing: 0.01em;
    }
}

/* زر الإغلاق */
.toast-close {
    background: rgba(100, 116, 139, 0.1);
    border: none;
    color: #64748b;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.toast-close:hover {
    background: rgba(100, 116, 139, 0.15);
    transform: scale(1.1);
}

.toast-close i {
    font-size: 0.75rem;
}

@media (max-width: 480px) {
    .toast-close {
        width: 22px;
        height: 22px;
    }
    
    .toast-close i {
        font-size: 0.7rem;
    }
}

/* شريط علوي ملون حسب النوع */
.toast-success::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2da854 0%, #25924a 100%);
    border-radius: 16px 16px 0 0;
}

.toast-error::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #e32e21 0%, #c7261a 100%);
    border-radius: 16px 16px 0 0;
}

.toast-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3490dc 0%, #2b7bc4 100%);
    border-radius: 16px 16px 0 0;
}

.toast-warning::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #f5a623 0%, #dd941f 100%);
    border-radius: 16px 16px 0 0;
}

/* Responsive */
@media (max-width: 576px) {
    .toast-notification {
        min-width: auto;
        max-width: calc(100vw - 40px);
        left: 20px !important;
        right: 20px !important;
        transform: translateY(-100%) !important;
    }
    
    .toast-top-right,
    .toast-top-left,
    .toast-top-center {
        top: 20px;
    }
    
    .toast-bottom-right,
    .toast-bottom-left,
    .toast-bottom-center {
        bottom: 20px;
        top: auto;
        transform: translateY(100%) !important;
    }
    
    .toast-show {
        transform: translateY(0) !important;
    }
}

/* تأثير Pulse للأيقونة */
@keyframes toast-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.toast-show .toast-icon {
    animation: toast-pulse 0.5s ease;
}

/* شريط التقدم (اختياري) */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0 0 0 12px;
    animation: toast-progress-animation 3s linear;
}

@keyframes toast-progress-animation {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* تأثير Hover */
.toast-notification.toast-show:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.toast-notification.toast-show.toast-top-center:hover,
.toast-notification.toast-show.toast-bottom-center:hover {
    transform: translateX(-50%) translateY(-2px) !important;
}

/* Clickable Toast Styles */
.toast-clickable {
    cursor: pointer !important;
    transition: all 0.2s ease;
}

.toast-clickable.toast-show:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95em;
    color: inherit;
    margin-bottom: 2px;
}

.toast-link-hint {
    font-size: 0.8em !important;
    color: #64748b !important;
    margin-top: 4px !important;
    font-style: italic;
}

/* دعم RTL */
[dir="rtl"] .toast-top-right {
    right: auto;
    left: 20px;
    transform: translateX(-100%);
}

[dir="rtl"] .toast-top-left {
    left: auto;
    right: 20px;
    transform: translateX(100%);
}

[dir="rtl"] .toast-bottom-right {
    right: auto;
    left: 20px;
    transform: translateX(-100%);
}

[dir="rtl"] .toast-bottom-left {
    left: auto;
    right: 20px;
    transform: translateX(100%);
}

[dir="rtl"] .toast-show {
    transform: translateX(0) translateY(0) !important;
}

[dir="rtl"] .toast-show.toast-top-center,
[dir="rtl"] .toast-show.toast-bottom-center {
    transform: translateX(-50%) translateY(0) !important;
}
