/* ABOUTME: Styles for modal dialogs, forms, and activity editing UI */

/* ABOUTME: Used by the universal modal system and activity form overlays */

/* Modal Styles */

/* Activity Form Styles */
.activity-status-message {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.4;
}

.activity-status-message p {
  margin: 0;
}

.activity-status-message.planned {
  background: linear-gradient(135deg, #FFF4E6, #FFE8CC);
  border: 1px solid #FFD4A3;
}

.activity-status-message.planned p {
  color: #8B5A00;
}

.activity-status-message.logged {
  background: var(--info-50);
  border: 1px solid var(--info-200);
}

.activity-status-message.logged p {
  color: var(--info-800);
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: rgb(0 0 0 / 50%);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  margin: 0 auto;
  padding: 1.75rem 0;
  width: min(600px, 90%);
}

.modal-dialog > div {
  width: 100%;
}

.modal-dialog.modal-narrow {
  max-width: 450px;
}

.modal-content {
  background-color: var(--surface);
  padding: 0;
  border: none;
  border-radius: var(--radius-xl);
  width: 100%;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 10%), 0 10px 10px -5px rgb(0 0 0 / 4%);
  position: relative;
  overflow: hidden;
}

.modal-content.modal-lg {
  max-width: 600px;
}

.modal-content.modal-xl {
  max-width: 800px;
}

.modal-header {
  padding: var(--space-5) var(--space-5) 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 800;
  max-width: 100%;
}

/* Modal close button */
.modal-header .close,
.modal-close {
  width: 32px;
  height: 32px;
  background: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-header .close:hover,
.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  gap: 0;
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border);
  margin-top: var(--space-3);
}

.modal-tabs .modal-tab-btn {
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
}

.modal-tabs .modal-tab-btn:hover {
  color: var(--text);
}

.modal-tabs .modal-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.modal-tab-panel {
  display: none;
}

.modal-tab-panel.active {
  display: block;
}

/* Modal Icons */
.modal-icon {
  display: flex;
  justify-content: center;
  padding: 2rem 1.5rem 0;
}

.modal-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.modal-icon-wrapper.danger {
  background: #fee2e2;
  color: var(--error-600);
}

.modal-icon-wrapper.warning {
  background: #fef3c7;
  color: var(--warning-600);
}

.modal-icon-wrapper.success {
  background: #d1fae5;
  color: var(--success-600);
}

.modal-icon-wrapper.info {
  background: var(--primary-100);
  color: var(--primary-600);
}

.modal-header.with-icon {
  padding-top: 1rem;
  justify-content: center;
}

.modal-body {
  padding: var(--space-5);
  max-height: 70vh;
  overflow-y: auto;
}

.modal-body p {
  margin: 0 0 var(--space-4);
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  position: relative;
}

/* Modal scroll shadows */
.modal-scroll-shadow-top,
.modal-scroll-shadow-bottom {
  position: absolute;
  left: 0;
  right: 0;
  height: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  width: 100%;
  z-index: 25;
}

.modal-scroll-shadow-top {
  display: none; /* Removed - only bottom shadow should indicate scrollability */
}

.modal-scroll-shadow-bottom {
  bottom: 71px; /* Above modal footer */
  background: linear-gradient(to top, rgb(0 0 0 / 15%), transparent);
}

.modal-scroll-shadow-top.visible,
.modal-scroll-shadow-bottom.visible {
  opacity: 1;
}

.modal-body {
  position: relative;
}

/* Modal specific styles */
.confirmation-modal .modal-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.confirmation-modal .modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.delete-confirmation-modal .delete-warning {
  background-color: var(--error-50);
  border: 1px solid var(--error-200);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.delete-confirmation-modal .delete-warning-icon {
  color: var(--error-500);
  margin-right: 0.5rem;
}

.delete-confirmation-modal .delete-warning-text {
  color: var(--error-700);
  font-size: 0.9375rem;
  margin: 0;
}

/* Activity Item Modal */
.activity-item-modal .modal-content {
  max-width: 500px;
}

.activity-item-modal .modal-body {
  padding: 1.5rem;
}

/* Profile Fact Modal */
.profile-fact-modal .modal-content {
  max-width: 600px;
}

/* Revert Confirmation Modal */
.revert-confirmation-modal .changes-preview {
  background-color: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}

.revert-confirmation-modal .change-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-200);
}

.revert-confirmation-modal .change-row:last-child {
  border-bottom: none;
}

.revert-confirmation-modal .change-label {
  font-weight: 500;
  color: var(--gray-700);
  min-width: 100px;
}

.revert-confirmation-modal .change-value {
  color: var(--gray-900);
}

.revert-confirmation-modal .change-value-old {
  color: var(--error-600);
  text-decoration: line-through;
}

.revert-confirmation-modal .change-value-new {
  color: var(--success-600);
  margin-left: 0.5rem;
}

/* Modal animation */
@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }

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

/* Modal animations disabled */
.modal.modal-active {
  animation: none;
}

.modal.modal-active .modal-content {
  animation: none;
}

/* Scroll Indicators - Dots */
.modal-footer .scroll-dots {
  position: absolute;
  top: auto;
  bottom: 52px; /* Position just above the buttons */
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 0.3rem;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 0.2rem 0.6rem;
  background: var(--gray-50);
  border-radius: 1rem;
}

.scroll-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gray-400);
  transition: all 0.2s;
}

.scroll-dot.active {
  background: var(--yafa-orange);
  transform: scale(1.5);
}

/* Form field groups */
.form-field-group {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Mobile responsive - Bottom sheet style */
@media (width <= 768px) {
  .modal-dialog {
    align-items: flex-end;
    justify-content: stretch;
    padding: 0;
    width: 100%;
    max-width: 100%;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 24px 24px 0 0;
    max-height: 90vh;
    animation: slideUp 0.3s ease;
  }

  .modal-body {
    max-height: 65vh;
  }

  .modal-content.with-form {
    max-height: 90vh;
  }

  .modal-header {
    padding: 20px 20px 16px;
  }

  /* Drag handle indicator */
  .modal-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
  }

  /* Stack grouped fields on mobile */
  .form-field-group {
    grid-template-columns: 1fr !important;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0.5;
  }

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

/* Tom-select dropdown in modals */
.ts-dropdown {
  z-index: 1100 !important; /* Above modal (z-index: 1000) */
}