/**
 * Modal System - Tutarlı popup tasarımı
 * Euroway Kariyer Portali
 */

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalBackdropIn 0.2s ease;
}

.modal-backdrop.modal-closing {
  animation: modalBackdropOut 0.2s ease forwards;
}

/* Modal Container */
.modal-container {
  background: white;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
}

.modal-backdrop.modal-closing .modal-container {
  animation: modalSlideOut 0.2s ease forwards;
}

/* Modal Sizes */
.modal-sm { max-width: 400px; }
.modal-md { max-width: 600px; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1200px; }
.modal-full { max-width: 95vw; max-height: 95vh; }

/* Modal Header */
.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 20px;
  font-weight: 900;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.02em;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  line-height: 1;
  transition: all 0.2s;
  flex-shrink: 0;
}

.modal-close:hover {
  background-color: #f1f5f9;
  color: #475569;
  transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Modal Footer */
.modal-footer {
  padding: 20px 28px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.modal-footer-left {
  justify-content: space-between;
}

.modal-footer-center {
  justify-content: center;
}

/* Modal Animations */
@keyframes modalBackdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(40px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalSlideOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
}

/* Dark Mode */
[data-theme="dark"] .modal-container {
  background: #1e293b;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  border-color: #334155;
}

[data-theme="dark"] .modal-title {
  color: #f1f5f9;
}

[data-theme="dark"] .modal-close:hover {
  background-color: #334155;
  color: #cbd5e1;
}

[data-theme="dark"] .modal-body::-webkit-scrollbar-track {
  background: #334155;
}

[data-theme="dark"] .modal-body::-webkit-scrollbar-thumb {
  background: #475569;
}

/* Responsive */
@media (max-width: 640px) {
  .modal-container {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    margin-top: auto;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* Utility Classes */
.modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #64748b;
}

.modal-loading::after {
  content: "";
  width: 40px;
  height: 40px;
  border: 4px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Modal no padding variant */
.modal-no-padding .modal-body {
  padding: 0;
}

.modal-no-header .modal-header {
  display: none;
}

.modal-no-footer .modal-footer {
  display: none;
}
