.dialog-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: none;
  animation: fadeIn var(--transition-base);
}

.dialog-backdrop.open {
  display: block;
}

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

.dialog-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  display: none;
  animation: scaleIn var(--transition-base);
}

.dialog-modal.open {
  display: flex;
  flex-direction: column;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.dialog-modal.sm {
  max-width: 400px;
}

.dialog-modal.md {
  max-width: 600px;
}

.dialog-modal.lg {
  max-width: 800px;
}

.dialog-modal.xl {
  max-width: 1000px;
}

.dialog-modal.full {
  max-width: calc(100vw - var(--space-8));
  max-height: calc(100vh - var(--space-8));
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-color);
}

.dialog-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
  margin: 0;
}

.dialog-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--gray-500);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dialog-close:hover {
  background: var(--bg-hover);
  color: var(--gray-900);
}

.dialog-close-icon {
  width: 20px;
  height: 20px;
}

.dialog-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

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

.dialog-body::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 4px;
}

.dialog-body::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

.dialog-body::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-6);
  border-top: 1px solid var(--border-color);
}

.dialog-footer-left {
  justify-content: flex-start;
}

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

.dialog-footer-between {
  justify-content: space-between;
}

/* Confirmation dialog */
.dialog-confirm {
  max-width: 450px;
}

.dialog-confirm-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.dialog-confirm-icon.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.dialog-confirm-icon.danger {
  background: var(--danger-light);
  color: var(--danger);
}

.dialog-confirm-icon.info {
  background: var(--info-light);
  color: var(--info);
}

.dialog-confirm-icon.success {
  background: var(--success-light);
  color: var(--success);
}

.dialog-confirm-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
  text-align: center;
  margin-bottom: var(--space-3);
}

.dialog-confirm-message {
  font-size: var(--text-sm);
  color: var(--gray-600);
  text-align: center;
  margin-bottom: var(--space-6);
}

/* Alert dialog */
.dialog-alert {
  max-width: 400px;
}

.dialog-alert .dialog-body {
  text-align: center;
  padding: var(--space-8);
}

/* Drawer (slide from side) */
.dialog-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 90%;
  max-width: 500px;
  max-height: 100vh;
  background: var(--white);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  display: none;
  animation: slideInRight var(--transition-base);
}

.dialog-drawer.open {
  display: flex;
}

.dialog-drawer.left {
  left: 0;
  animation: slideInLeft var(--transition-base);
}

.dialog-drawer.right {
  right: 0;
  animation: slideInRight var(--transition-base);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Bottom sheet (mobile) */
.dialog-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-height: 90vh;
  background: var(--white);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  display: none;
  animation: slideUp var(--transition-base);
}

.dialog-sheet.open {
  display: flex;
  flex-direction: column;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.dialog-sheet-handle {
  display: flex;
  justify-content: center;
  padding: var(--space-3) 0;
}

.dialog-sheet-handle-bar {
  width: 40px;
  height: 4px;
  background: var(--gray-300);
  border-radius: 2px;
}

/* Loading dialog */
.dialog-loading {
  max-width: 320px;
  text-align: center;
}

.dialog-loading-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.dialog-loading-text {
  font-size: var(--text-sm);
  color: var(--gray-600);
}

/* Responsive */
@media (max-width: 768px) {
  .dialog-modal {
    width: 95%;
    max-width: none;
  }

  .dialog-modal.full {
    max-width: calc(100vw - var(--space-4));
    max-height: calc(100vh - var(--space-4));
  }

  .dialog-drawer {
    width: 100%;
    max-width: none;
  }

  .dialog-header,
  .dialog-body,
  .dialog-footer {
    padding: var(--space-4);
  }
}
