/**
 * EntityModal.css
 * Unified modal styles for Sector and Spray Wall creation/editing
 *
 * Combines and extends styles from SectorModal.css and WallModal.css
 */

/* Modal Container */
.entity-modal .modal-dialog {
  max-width: 600px;
}

.entity-modal .modal-content {
  background: rgb(33,37,41);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
}

/* Header */
.entity-modal-header {
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.entity-modal-header .modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary, #fff);
  flex: 1;
}

.entity-modal-header .btn-close {
  filter: invert(1);
  opacity: 0.7;
}

.entity-modal-header .btn-close:hover {
  opacity: 1;
}

.entity-modal-header .btn-header-back {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.entity-modal-header .btn-header-back:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Body */
.entity-modal .modal-body {
  padding: 0;
  background: rgb(33,37,41);
}

/* Slide Container */
.entity-slide-container {
  overflow: hidden;
  position: relative;
}

.entity-slide-wrapper {
  display: flex;
  transition: transform 0.3s ease;
  width: 200%;
}

.entity-slide-wrapper.view-form {
  transform: translateX(0);
}

.entity-slide-wrapper.view-media {
  transform: translateX(-50%);
}

.entity-slide-panel {
  width: 50%;
  flex-shrink: 0;
}

.entity-slide-panel.form-panel {
  padding: 20px;
}

.entity-slide-panel.media-panel {
  padding: 0;
  min-height: 500px;
}

/* MediaPickerContent fills the panel */
.entity-slide-panel.media-panel .media-picker-content-panel {
  height: 100%;
  min-height: 500px;
}

/* Type Selector */
.entity-modal__type-select {
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary, #fff);
}

.entity-modal__type-select:focus {
  border-color: rgba(186, 255, 102, 1);
  box-shadow: 0 0 0 3px rgba(186, 255, 102, 0.15);
}

.entity-modal__type-select:disabled {
  background-color: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
}

.entity-modal__type-select option {
  background: #1a1a2e;
  color: var(--text-primary, #fff);
}

/* Footer */
.entity-modal .modal-footer {
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px 20px;
  gap: 12px;
}

.entity-modal .modal-footer .btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-weight: 500;
}

/* Save/Primary button - Rumble green with increased specificity */
.entity-modal.modal .modal-footer .btn-primary,
.entity-modal .modal-footer .btn-primary {
  background: #B9FF66 !important;
  border-color: #B9FF66 !important;
  color: #1a1a2e !important;
}

.entity-modal.modal .modal-footer .btn-primary:hover,
.entity-modal .modal-footer .btn-primary:hover {
  background: #a8e85c !important;
  border-color: #a8e85c !important;
  color: #1a1a2e !important;
}

.entity-modal.modal .modal-footer .btn-primary:focus,
.entity-modal .modal-footer .btn-primary:focus {
  background: #a8e85c !important;
  border-color: #a8e85c !important;
  box-shadow: 0 0 0 0.2rem rgba(185, 255, 102, 0.5) !important;
}

.entity-modal .modal-footer .btn-primary:disabled {
  background: rgba(185, 255, 102, 0.5) !important;
  border-color: rgba(185, 255, 102, 0.5) !important;
  color: rgba(26, 26, 46, 0.7) !important;
}

.entity-modal .modal-footer .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

.entity-modal .modal-footer .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.entity-modal .modal-footer .btn-outline-danger {
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}

.entity-modal .modal-footer .btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

/* Delete Confirm */
.delete-confirm-content {
  padding: 24px;
  text-align: center;
}

.delete-confirm-content p {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 16px;
}

.delete-confirm-content .text-danger {
  color: #ef4444 !important;
}

.delete-confirm-content .d-flex {
  justify-content: center;
}

/* Form Overrides for dark theme */
.entity-modal .form-label {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
}

/* Form inputs - dark theme with reinforced specificity */
.entity-modal .form-control,
.entity-modal .form-select,
.entity-modal textarea.form-control {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

.entity-modal .form-control:focus,
.entity-modal .form-select:focus,
.entity-modal textarea.form-control:focus {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(185, 255, 102, 0.5) !important;
  box-shadow: 0 0 0 0.2rem rgba(185, 255, 102, 0.15) !important;
  color: #ffffff !important;
}

.entity-modal .form-control::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* Dark dropdown options */
.entity-modal .form-select option {
  background: #1a1a2e !important;
  color: #ffffff !important;
}

/* Hide any duplicate sector-settings-panel header inside EntityModal */
.entity-modal .sector-settings-panel__header {
  display: none;
}

/* Date input dark theme */
.entity-modal .form-control[type="date"] {
  color-scheme: dark;
}

.entity-modal .form-control[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(0.8);
  cursor: pointer;
}

.entity-modal .form-text {
  color: rgba(255, 255, 255, 0.5) !important;
  font-size: 0.75rem;
}

.entity-modal .invalid-feedback {
  color: #ef4444;
}

/* Mobile Fullscreen */
@media (max-width: 575.98px) {
  .entity-modal .modal-dialog {
    margin: 0;
    max-width: 100%;
    height: 100%;
  }

  .entity-modal .modal-content {
    height: 100%;
    border-radius: 0;
  }

  .entity-slide-panel.form-panel {
    padding: 16px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .entity-slide-wrapper {
    transition: none;
  }
}

/* ============================================
   Media Picker Footer - Sticky at bottom
   ============================================ */

/* Desktop: Make footer sticky at bottom of media panel */
.entity-modal .entity-slide-panel.media-panel .media-picker-inline-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: rgb(33, 37, 41);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Ensure media panel has proper scroll behavior for sticky to work */
.entity-modal .entity-slide-panel.media-panel {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 100%;
}

/* Ensure content area scrolls while footer stays fixed */
.entity-modal .entity-slide-panel.media-panel .media-picker-content-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Content area should scroll */
.entity-modal .entity-slide-panel.media-panel .media-picker-inline-content {
  flex: 1;
  overflow-y: auto;
}

/* Fix media picker footer on mobile - constrain to viewport */
@media (max-width: 768px) {
  .entity-modal .media-picker-inline-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    z-index: 1060;
    box-sizing: border-box;
  }

  /* Add padding at bottom of media panel for fixed footer 
  .entity-modal .entity-slide-panel.media-panel {
    padding-bottom: 80px;
  }

  .entity-modal .entity-slide-panel.media-panel .media-picker-inline-content {
    padding-bottom: 100px;
  } */
}
