/* ===== Modal Messages System - نظام الرسائل الاحترافي ===== */

/* Modal Overlay - خلفية الـ Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Modal Container - حاوي الرسالة */
.modal-message {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 450px;
  width: 90%;
  margin: 20px;
  transform: scale(0.7) translateY(50px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  position: relative;
}

.modal-overlay.show .modal-message {
  transform: scale(1) translateY(0);
}

/* Modal Header - رأس الرسالة */
.modal-header {
  padding: 25px 30px 20px;
  text-align: center;
  position: relative;
}

.modal-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px;
  font-size: 32px;
  color: white;
  position: relative;
  overflow: hidden;
}

.modal-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: inherit;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

/* Icon Types - أنواع الأيقونات */
.modal-icon.error {
  background: linear-gradient(135deg, #ff4757, #ff3742);
}

.modal-icon.success {
  background: linear-gradient(135deg, #2ed573, #1dd1a1);
}

.modal-icon.warning {
  background: linear-gradient(135deg, #ffa502, #ff6348);
}

.modal-icon.info {
  background: linear-gradient(135deg, #3742fa, #2f3542);
}

/* Modal Title - عنوان الرسالة */
.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #2c3e50;
  margin: 0 0 10px;
  font-family: 'Cairo', sans-serif;
}

/* Modal Body - محتوى الرسالة */
.modal-body {
  padding: 0 30px 25px;
  text-align: center;
}

.modal-text {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #5a6c7d;
  margin: 0;
  font-family: 'Cairo', sans-serif;
  font-weight: 500;
}

/* Modal Actions - أزرار الإجراءات */
.modal-actions {
  padding: 20px 30px 30px;
  display: flex;
  gap: 15px;
  justify-content: center;
}

.modal-btn {
  padding: 12px 30px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Cairo', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  min-width: 120px;
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.modal-btn:active {
  transform: translateY(0);
}

/* Primary Button - الزر الأساسي */
.modal-btn.primary {
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  color: white;
}

.modal-btn.primary:hover {
  background: linear-gradient(135deg, #0d47a1, #1565c0);
}

/* Secondary Button - الزر الثانوي */
.modal-btn.secondary {
  background: #f8f9fa;
  color: #6c757d;
  border: 2px solid #e9ecef;
}

.modal-btn.secondary:hover {
  background: #e9ecef;
  color: #495057;
}

/* Close Button - زر الإغلاق */
.modal-close {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 35px;
  height: 35px;
  border: none;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #666;
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.2);
  color: #333;
  transform: rotate(90deg);
}

/* Ripple Effect - تأثير الموجة */
.modal-btn {
  position: relative;
  overflow: hidden;
}

.modal-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: width 0.6s, height 0.6s, top 0.6s, left 0.6s;
  transform: translate(-50%, -50%);
}

.modal-btn:active::before {
  width: 300px;
  height: 300px;
}

/* Animation Classes - فئات الأنيميشن */
.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.bounce {
  animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Success Animation - أنيميشن النجاح */
.success-checkmark {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
  stroke-width: 3;
  stroke: #2ed573;
  stroke-miterlimit: 10;
  margin: 10px auto;
  box-shadow: inset 0px 0px 0px #2ed573;
  animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.success-checkmark__circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 3;
  stroke-miterlimit: 10;
  stroke: #2ed573;
  fill: none;
  animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.success-checkmark__check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes scale {
  0%, 100% {
    transform: none;
  }
  50% {
    transform: scale3d(1.1, 1.1, 1);
  }
}

@keyframes fill {
  100% {
    box-shadow: inset 0px 0px 0px 30px #2ed573;
  }
}

/* Responsive Design - التصميم المتجاوب */
@media (max-width: 768px) {
  .modal-message {
    max-width: 350px;
    margin: 15px;
  }
  
  .modal-header {
    padding: 20px 25px 15px;
  }
  
  .modal-body {
    padding: 0 25px 20px;
  }
  
  .modal-actions {
    padding: 15px 25px 25px;
    flex-direction: column;
  }
  
  .modal-btn {
    width: 100%;
    margin: 5px 0;
  }
  
  .modal-icon {
    width: 60px;
    height: 60px;
    font-size: 28px;
  }
  
  .modal-title {
    font-size: 1.2rem;
  }
  
  .modal-text {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .modal-message {
    max-width: 320px;
    margin: 10px;
  }
  
  .modal-header {
    padding: 15px 20px 10px;
  }
  
  .modal-body {
    padding: 0 20px 15px;
  }
  
  .modal-actions {
    padding: 10px 20px 20px;
  }
  
  .modal-icon {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }
  
  .modal-title {
    font-size: 1.1rem;
  }
  
  .modal-text {
    font-size: 0.95rem;
  }
}

/* Dark Mode Support - دعم الوضع المظلم */
@media (prefers-color-scheme: dark) {
  .modal-message {
    background: #2c3e50;
    color: #ecf0f1;
  }
  
  .modal-title {
    color: #ecf0f1;
  }
  
  .modal-text {
    color: #bdc3c7;
  }
  
  .modal-btn.secondary {
    background: #34495e;
    color: #ecf0f1;
    border-color: #4a5f7a;
  }
  
  .modal-btn.secondary:hover {
    background: #4a5f7a;
  }
  
  .modal-close {
    background: rgba(255, 255, 255, 0.1);
    color: #bdc3c7;
  }
  
  .modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ecf0f1;
  }
}

/* Loading State - حالة التحميل */
.modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #1565c0;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Custom Scrollbar for Modal Content */
.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Enhanced Professional Styles */
.modal-message.professional {
  border-top: 4px solid #1565c0;
}

.modal-message.professional .modal-header {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 20px 20px 0 0;
}

.modal-text strong {
  color: #1565c0;
  font-weight: 700;
}

.modal-text br + br {
  line-height: 2;
}

/* Email Verification Modal Specific Styles */
.email-verification-modal {
  max-width: 500px;
}

.email-verification-modal .modal-body {
  padding: 0 30px 30px;
}

.email-verification-modal .modal-text {
  text-align: right;
  line-height: 1.8;
}

/* Enhanced Button Styles */
.modal-btn {
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.modal-btn:focus {
  outline: 2px solid #1565c0;
  outline-offset: 2px;
}

/* Success Message Enhancement */
.modal-icon.success::after {
  content: '✓';
  position: absolute;
  font-size: 24px;
  font-weight: bold;
  color: white;
  animation: checkmark 0.6s ease-in-out 0.3s both;
}

@keyframes checkmark {
  0% {
    transform: scale(0) rotate(45deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Error Message Enhancement */
.modal-icon.error::after {
  content: '✕';
  position: absolute;
  font-size: 24px;
  font-weight: bold;
  color: white;
  animation: errormark 0.6s ease-in-out 0.3s both;
}

@keyframes errormark {
  0% {
    transform: scale(0) rotate(180deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Warning Message Enhancement */
.modal-icon.warning::after {
  content: '!';
  position: absolute;
  font-size: 28px;
  font-weight: bold;
  color: white;
  animation: warningmark 0.6s ease-in-out 0.3s both;
}

@keyframes warningmark {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Info Message Enhancement */
.modal-icon.info::after {
  content: 'i';
  position: absolute;
  font-size: 24px;
  font-weight: bold;
  color: white;
  font-style: italic;
  animation: infomark 0.6s ease-in-out 0.3s both;
}

@keyframes infomark {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}