/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.3s ease-out;
}

.modal-overlay[aria-hidden="false"] {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal Base */
.modal {
  width: min(580px, calc(100% - 32px));
  background: linear-gradient(180deg, rgba(18,24,33,0.98), rgba(12,16,23,0.99));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 20px;
  box-shadow: 
    0 0 0 1px rgba(99, 102, 241, 0.1),
    0 20px 60px rgba(0,0,0,0.6),
    0 0 80px rgba(99, 102, 241, 0.15);
  color: #e6eef8;
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(99, 102, 241, 0.5) 20%, 
    rgba(168, 85, 247, 0.5) 50%,
    rgba(99, 102, 241, 0.5) 80%, 
    transparent);
  animation: shimmer 3s infinite;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shimmer {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Modal Auth Specific */
.modal-auth {
  width: min(640px, calc(100% - 32px));
}

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 32px 24px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.15);
  position: relative;
}

.modal-header-content {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.modal-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.modal-icon-wrapper::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(168, 85, 247, 0.4));
  filter: blur(8px);
  opacity: 0.5;
  z-index: -1;
}

.modal-icon {
  color: #818cf8;
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

.modal-title-group h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, #e6eef8, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 400;
}

/* Modal Body */
.modal-body {
  padding: 28px 32px 32px;
}

.modal-welcome {
  margin-bottom: 24px;
}

.modal-description {
  margin: 0;
  color: #cbd5e1;
  font-size: 15px;
  line-height: 1.6;
  text-align: center;
}

/* Divider */
.modal-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 28px 0 24px;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.3), transparent);
}

/* Modal Close Button */
.modal-close {
  height: 36px;
  width: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #94a3b8;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
  transform: rotate(90deg);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

/* Auth Buttons */
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}

.auth-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.5));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.auth-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.auth-btn:hover::before {
  opacity: 1;
}

.auth-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(99, 102, 241, 0.2);
}

.auth-btn:active {
  transform: translateY(0);
}

.auth-btn-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 12px;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.auth-btn:hover .auth-btn-icon {
  background: rgba(99, 102, 241, 0.25);
  transform: scale(1.05);
}

.auth-btn-github .auth-btn-icon {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
}

.auth-btn-github:hover .auth-btn-icon {
  background: rgba(139, 92, 246, 0.25);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.auth-btn-google .auth-btn-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.auth-btn-google:hover .auth-btn-icon {
  background: rgba(59, 130, 246, 0.25);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.auth-btn-content {
  flex: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-btn-title {
  font-size: 16px;
  font-weight: 600;
  color: #e6eef8;
  display: block;
}

.auth-btn-description {
  font-size: 13px;
  color: #94a3b8;
  display: block;
}

.auth-btn-arrow {
  color: #64748b;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
}

.auth-btn:hover .auth-btn-arrow {
  color: #818cf8;
  transform: translateX(4px);
}

/* Features Section */
.modal-features {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 28px 0 24px;
  padding: 20px;
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-radius: 12px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #cbd5e1;
}

.feature-icon {
  color: #818cf8;
  flex-shrink: 0;
}

/* Footer Text */
.modal-footer-text {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  text-align: center;
  line-height: 1.6;
}

.modal-link {
  color: #818cf8;
  text-decoration: none;
  transition: color 0.2s ease;
}

.modal-link:hover {
  color: #a5b4fc;
  text-decoration: underline;
}

/* Legacy Support */
.modal .btn {
  height: 44px;
  padding: 0 16px;
}

/* Responsive */
@media (max-width: 640px) {
  .modal-auth {
    width: calc(100% - 24px);
    border-radius: 16px;
  }
  
  .modal-header {
    padding: 20px 20px 16px;
  }
  
  .modal-body {
    padding: 20px;
  }
  
  .modal-icon-wrapper {
    width: 48px;
    height: 48px;
  }
  
  .modal-title-group h3 {
    font-size: 19px;
  }
  
  .modal-features {
    flex-direction: column;
    gap: 12px;
  }
  
  .auth-btn {
    padding: 16px 18px;
  }
  
  .auth-btn-icon {
    width: 42px;
    height: 42px;
  }
}
