/**
 * Attendance Notification System - Professional Styles
 * تصميم احترافي لنظام الإشعارات
 */

/* حاوية الإشعارات الرئيسية */
.attendance-notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 420px;
  width: calc(100% - 40px);
}

/* تعديل حجم الإشعارات بناءً على حجم الشاشة */
@media (max-width: 414px) { /* iPhone Plus/Pro Max */
  .attendance-notification {
    font-size: 12px;
  }
  .attendance-notification-wrapper {
    padding: 10px 12px;
  }
}

@media (max-width: 375px) { /* iPhone standard */
  .attendance-notification {
    min-height: 50px;
  }
  .attendance-notification-icon {
    width: 26px;
    height: 26px;
  }
  .attendance-notification-icon svg {
    width: 15px;
    height: 15px;
  }
}

@media (max-width: 320px) { /* Very small devices */
  .attendance-notification-container {
    top: 3px;
    right: 3px;
    left: 3px;
  }
  .attendance-notification {
    min-height: 45px;
    font-size: 11px;
  }
  .attendance-notification-message {
    font-size: 11px;
  }
}

/* الإشعار الأساسي */
.attendance-notification {
  position: relative;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15),
              0 2px 10px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  pointer-events: all;
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  border: 1px solid rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  min-height: 80px;
}

.attendance-notification.show {
  transform: translateX(0);
  opacity: 1;
}

.attendance-notification.hide {
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s ease-in;
}

/* Wrapper للمحتوى */
.attendance-notification-wrapper {
  display: flex;
  align-items: center;
  padding: 16px;
  gap: 14px;
  position: relative;
  z-index: 2;
}

/* الأيقونة */
.attendance-notification-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  position: relative;
  animation: iconPulse 2s ease-in-out infinite;
}

.attendance-notification-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

@keyframes iconPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* المحتوى */
.attendance-notification-content {
  flex: 1;
  min-width: 0;
}

.attendance-notification-message {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #2c3e50;
  font-weight: 500;
  word-wrap: break-word;
  margin: 0;
  direction: rtl;
}

/* زر الإغلاق */
.attendance-notification-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
  opacity: 0.6;
  outline: none;
}

.attendance-notification-close:hover {
  background: rgba(0, 0, 0, 0.05);
  opacity: 1;
  transform: rotate(90deg);
}

.attendance-notification-close svg {
  width: 16px;
  height: 16px;
  stroke: #6b7280;
}

/* شريط التقدم */
.attendance-notification-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.attendance-notification-progress-bar {
  height: 100%;
  background: currentColor;
  animation: progress linear forwards;
  transform-origin: left;
  animation-fill-mode: both;
}

@keyframes progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

/* أنواع الإشعارات */

/* Success */
.attendance-notification-success {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border-left: 4px solid #10b981;
}

.attendance-notification-success .attendance-notification-icon {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.attendance-notification-success .attendance-notification-icon svg {
  stroke: #ffffff;
  fill: none;
}

.attendance-notification-success .attendance-notification-progress-bar {
  background: linear-gradient(90deg, #10b981, #059669);
}

/* Error */
.attendance-notification-error {
  background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
  border-left: 4px solid #ef4444;
}

.attendance-notification-error .attendance-notification-icon {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
  animation: errorShake 0.5s ease-in-out;
}

.attendance-notification-error .attendance-notification-icon svg {
  stroke: #ffffff;
  fill: none;
}

.attendance-notification-error .attendance-notification-progress-bar {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
  20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Warning */
.attendance-notification-warning {
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
  border-left: 4px solid #f59e0b;
}

.attendance-notification-warning .attendance-notification-icon {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
  animation: warningBounce 1s ease-in-out;
}

.attendance-notification-warning .attendance-notification-icon svg {
  stroke: #ffffff;
  fill: none;
}

.attendance-notification-warning .attendance-notification-progress-bar {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

@keyframes warningBounce {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-5px); }
  75% { transform: translateY(3px); }
}

/* Info */
.attendance-notification-info {
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
  border-left: 4px solid #3b82f6;
}

.attendance-notification-info .attendance-notification-icon {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.attendance-notification-info .attendance-notification-icon svg {
  stroke: #ffffff;
  fill: none;
}

.attendance-notification-info .attendance-notification-progress-bar {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

/* شريط التقدم المخصص */
.attendance-notification-custom-progress {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.progress-bar-container {
  height: 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 3px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: progressShimmer 2s linear infinite;
}

@keyframes progressShimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progress-percentage {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  text-align: center;
}

/* أنيميشن دخول مختلفة */
.attendance-notification-slideInRight {
  animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.attendance-notification-fadeIn {
  animation: fadeIn 0.4s ease;
}

.attendance-notification-bounceIn {
  animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  }
}

/* تأثير الهوفر على الإشعار */
.attendance-notification:hover {
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2),
              0 5px 15px rgba(0, 0, 0, 0.1);
  transform: translateX(-5px) scale(1.02);
}

/* دعم الموبايل */
@media (max-width: 768px) {
  .attendance-notification-container {
    top: 10px;
    right: 5px;
    left: 5px;
    max-width: none;
    width: calc(100% - 10px);
    gap: 8px; /* تقليل المسافة بين الإشعارات */
  }
  
  .attendance-notification {
    transform: translateY(-100px);
    min-height: 60px; /* تقليل الارتفاع الأدنى */
    font-size: 13px; /* تصغير حجم الخط قليلاً */
  }
  
  .attendance-notification-wrapper {
    padding: 12px 14px; /* تقليل الحشو الداخلي */
    gap: 10px;
  }
  
  .attendance-notification-icon {
    width: 32px; /* تصغير الأيقونة */
    height: 32px;
  }
  
  .attendance-notification-icon svg {
    width: 18px; /* تصغير ال SVG */
    height: 18px;
  }
  
  .attendance-notification-message {
    font-size: 13px; /* حجم النص */
    line-height: 1.4;
  }
  
  .attendance-notification-close {
    width: 28px; /* تصغير زر الإغلاق */
    height: 28px;
  }
  
  .attendance-notification-close svg {
    width: 14px;
    height: 14px;
  }
  
  .attendance-notification-progress {
    height: 2px; /* تقليل سمك شريط التقدم */
  }
  
  /* التقدم المخصص */
  .attendance-notification-custom-progress {
    margin-top: 8px;
    padding-top: 8px;
  }
  
  .progress-bar-container {
    height: 5px; /* تقليل ارتفاع شريط التقدم */
    margin-bottom: 6px;
  }
  
  .progress-percentage {
    font-size: 11px; /* حجم نص النسبة المئوية */
  }
  
  .attendance-notification.show {
    transform: translateY(0);
  }
  
  .attendance-notification.hide {
    transform: translateY(-100px);
  }
  
  .attendance-notification:hover {
    transform: none;
  }
  
  @keyframes slideInRight {
    from {
      transform: translateY(-100px);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
}

/* دعم الموبايل الصغير */
@media (max-width: 480px) {
  .attendance-notification-container {
    top: 5px;
    right: 5px;
    left: 5px;
    gap: 6px;
  }
  
  .attendance-notification {
    min-height: 55px;
    font-size: 12px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
  }
  
  .attendance-notification-wrapper {
    padding: 10px 12px;
    gap: 8px;
  }
  
  .attendance-notification-icon {
    width: 28px;
    height: 28px;
  }
  
  .attendance-notification-icon svg {
    width: 16px;
    height: 16px;
  }
  
  .attendance-notification-message {
    font-size: 12px;
    line-height: 1.35;
  }
  
  .attendance-notification-close {
    width: 26px;
    height: 26px;
  }
  
  .attendance-notification-close svg {
    width: 12px;
    height: 12px;
  }
}

/* دعم الثيم الداكن */
@media (prefers-color-scheme: dark) {
  .attendance-notification {
    background: #1f2937;
    border: 1px solid rgba(75, 85, 99, 0.3);
    color: #f3f4f6;
  }
  
  .attendance-notification-message {
    color: #e5e7eb;
  }
  
  .attendance-notification-close svg {
    stroke: #9ca3af;
  }
  
  .attendance-notification-close:hover {
    background: rgba(255, 255, 255, 0.1);
  }
  
  .attendance-notification-success {
    background: linear-gradient(135deg, #1f2937 0%, #065f46 20%);
  }
  
  .attendance-notification-error {
    background: linear-gradient(135deg, #1f2937 0%, #7f1d1d 20%);
  }
  
  .attendance-notification-warning {
    background: linear-gradient(135deg, #1f2937 0%, #78350f 20%);
  }
  
  .attendance-notification-info {
    background: linear-gradient(135deg, #1f2937 0%, #1e3a8a 20%);
  }
}

/* تأثيرات إضافية */
.attendance-notification::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.attendance-notification:hover::before {
  transform: translateX(100%);
}

/* إشعارات مجمعة */
.attendance-notification-grouped {
  position: relative;
}

.attendance-notification-grouped::after {
  content: attr(data-count);
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  animation: scaleIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scaleIn {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

/* شريط الإشعارات النشطة */
.attendance-notification-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 30px;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 999998;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.attendance-notification-indicator:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(59, 130, 246, 0.5);
}

.attendance-notification-indicator .badge {
  background: rgba(255, 255, 255, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
}

/* تأثيرات إضافية للإشعارات الهامة */
.attendance-notification-important {
  border: 2px solid rgba(239, 68, 68, 0.3);
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* إشعارات متحركة */
.attendance-notification-animated {
  background-size: 200% 200%;
  background-image: linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.1) 75%,
    transparent 75%,
    transparent
  );
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* دعم RTL */
[dir="rtl"] .attendance-notification-container {
  right: auto;
  left: 20px;
}

[dir="rtl"] .attendance-notification {
  transform: translateX(-400px);
  border-left: none;
  border-right: 4px solid;
}

[dir="rtl"] .attendance-notification.show {
  transform: translateX(0);
}

[dir="rtl"] .attendance-notification.hide {
  transform: translateX(-400px);
}

[dir="rtl"] .attendance-notification:hover {
  transform: translateX(5px) scale(1.02);
}
