/* Modal Styles - Add to app.css */

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

/* Modal Content */
.modal-content {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) * 2);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: slideUp 0.3s ease;
  position: relative;
  z-index: 10001;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Modal Header */
.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

.modal-header h3 i {
  color: hsl(var(--primary));
}
.modal-section h4 {
  margin-bottom: 0.8rem;
}
.modal-close {
  background: transparent;
  border: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--muted-foreground));
  transition: all 0.2s;
  font-size: 1.5rem;
}

.modal-close:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* Modal Body */
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  color: hsl(var(--foreground));
  line-height: 1.6;
}

.modal-body strong {
  font-weight: 600;
  color: hsl(var(--foreground));
}

.modal-body br {
  display: block;
  content: "";
  margin-top: 0.5rem;
}

.modal-body .user-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: hsl(var(--muted) / 0.3);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.modal-body .user-detail-item:last-child {
  margin-bottom: 0;
}

.modal-body .user-detail-item .detail-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-body .user-detail-item .detail-label i {
  font-size: 0.875rem;
}

.modal-body .user-detail-item .detail-value {
  font-size: 0.9375rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.modal-body .user-detail-item .detail-value.code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.8125rem;
  background: hsl(var(--muted) / 0.5);
  padding: 0.75rem;
  border-radius: calc(var(--radius) * 0.75);
  border-left: 3px solid hsl(var(--primary));
  white-space: pre-wrap;
  line-height: 1.5;
}

/* Modal Section */
.modal-section {
  margin-bottom: 1.5rem;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section h4 {
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.8rem;
}

/* Modal Form */
.modal-form {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-form .form-group {
  margin-bottom: 1.25rem;
}

.modal-form .form-group:last-child {
  margin-bottom: 0;
}

/* Modal Actions */
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem;
  border-top: 1px solid hsl(var(--border));
  margin-top: 1.5rem;
}

/* Modal Footer (alternative to modal-actions, placed at bottom of modal) */
.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  flex-shrink: 0;
}

.modal-footer .btn:first-child {
  margin-right: auto;
}

/* Responsive */
@media (max-width: 640px) {
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }
}

/* ===================== HTML5 Dialog Element Styles ===================== */
/* Styles for native <dialog> elements to match modal-* classes */

dialog {
  /* Reset browser defaults and center */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;

  /* Styling */
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) * 2);
  padding: 0;
  max-width: 640px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: dialogFadeIn 0.2s ease;
  color: hsl(var(--foreground));
  z-index: 10001;
}

/* Dialog-specific animation that works with centered positioning */
@keyframes dialogFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

/* Dialog content wrapper (optional, for semantic structure) */
dialog .dialog-content {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

/* Dialog Header - matches .modal-header */
dialog .dialog-header {
  padding: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

dialog .dialog-header h2,
dialog .dialog-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

dialog .dialog-header h2 i,
dialog .dialog-header h3 i {
  color: hsl(var(--primary));
}

dialog .dialog-close {
  background: transparent;
  border: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--muted-foreground));
  transition: all 0.2s;
  font-size: 1.25rem;
}

dialog .dialog-close:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* Dialog Body - matches .modal-body */
dialog .dialog-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  color: hsl(var(--foreground));
  line-height: 1.6;
}

/* Dialog Form - matches .modal-form */
dialog .dialog-form {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

dialog .dialog-form .form-group {
  margin-bottom: 1.25rem;
}

dialog .dialog-form .form-group:last-of-type {
  margin-bottom: 0;
}

dialog .dialog-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

dialog .dialog-form label .required {
  color: hsl(var(--destructive));
}

dialog .dialog-form input,
dialog .dialog-form select,
dialog .dialog-form textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  transition: border-color 0.2s, box-shadow 0.2s;
}

dialog .dialog-form input:focus,
dialog .dialog-form select:focus,
dialog .dialog-form textarea:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

dialog .dialog-form input::placeholder,
dialog .dialog-form textarea::placeholder {
  color: hsl(var(--muted-foreground));
}

dialog .dialog-form .form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 480px) {
  dialog .dialog-form .form-row {
    grid-template-columns: 1fr;
  }
}

/* Dialog Actions - matches .modal-actions */
dialog .dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  flex-shrink: 0;
}

/* Dialog Responsive */
@media (max-width: 640px) {
  dialog {
    width: 95%;
    max-height: 95vh;
    margin: auto;
  }

  dialog .dialog-actions {
    flex-direction: column-reverse;
  }

  dialog .dialog-actions button {
    width: 100%;
  }
}
