/* ============================================
   UNIFIED DIALOG STRUCTURE - MGRE
   ============================================
   This CSS file defines the unified structure for all dialogs.
   Dialogs are NOT affected by user color schemes or layout variants.
   All dialogs use consistent, fixed styling.
   ============================================ */

/* Dialog Overlay - Background */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
  z-index: 100000;
}

.dialog-overlay.show,
.dialog-overlay[style*="flex"] {
  display: flex !important;
}

/* Dialog Container */
.dialog {
  background: rgba(255, 255, 255, 0.98) !important;
  color: #333 !important;
  border: 2px solid #134F5C !important;
  border-radius: 12px;
  padding: 0;
  max-width: min(900px, calc(100vw - 40px));
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

/* Dialog Header */
.dialog-header {
  padding: 20px 30px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.98);
  position: relative;
}

/* Prevent any buttons except close button from appearing in header */
.dialog-header .dialog-button:not(.dialog-close-button) {
  display: none !important;
}

.dialog-title {
  color: #134F5C !important;
  font-size: 24px;
  font-weight: bold;
  margin: 0;
  padding: 0;
  flex: 1;
}

.dialog-subtitle {
  color: #666 !important;
  font-size: 16px;
  font-weight: 600;
  margin: 15px 0 10px 0;
  padding: 0;
}

/* Dialog Close Button (X) - Top Right */
.dialog-close-button {
  position: absolute !important;
  top: 15px !important;
  right: 15px !important;
  background: transparent !important;
  border: none !important;
  font-size: 28px !important;
  color: #666 !important;
  cursor: pointer !important;
  width: 30px !important;
  height: 30px !important;
  line-height: 1 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  transition: background 0.2s, color 0.2s;
  z-index: 10;
}

.dialog-close-button:hover {
  background: rgba(0, 0, 0, 0.1) !important;
  color: #333 !important;
}

.dialog-close-button:active {
  background: rgba(0, 0, 0, 0.15) !important;
}

/* Dialog Body - Scrollable Content Area */
.dialog-body,
.dialog-content {
  padding: 30px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  color: #333 !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.dialog-body *,
.dialog-content * {
  color: #333 !important;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* File input size constraint - prevent oversized file inputs */
.dialog-body input[type="file"],
.dialog-content input[type="file"] {
  max-width: 100%;
  box-sizing: border-box;
}

/* Dialog Footer - Action Buttons */
.dialog-footer,
.dialog-buttons {
  padding: 20px 30px;
  border-top: 2px solid rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.98);
  position: relative !important;
}

/* Ensure buttons in footer stay in footer - prevent them from being moved to header */
.dialog-footer .dialog-button,
.dialog-buttons .dialog-button {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  float: none !important;
}

/* Dialog Buttons */
.dialog-button {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative !important;
}

.dialog-button-primary {
  background: #134F5C !important;
  color: white !important;
}

.dialog-button-primary:hover:not(:disabled) {
  background: #0d3d47 !important;
}

.dialog-button-primary:disabled {
  background: #ccc !important;
  cursor: not-allowed;
  opacity: 0.6;
}

.dialog-button-secondary {
  background: #6c757d !important;
  color: white !important;
}

.dialog-button-secondary:hover:not(:disabled) {
  background: #5a6268 !important;
}

.dialog-button-danger {
  background: #dc3545 !important;
  color: white !important;
}

.dialog-button-danger:hover:not(:disabled) {
  background: #c82333 !important;
}

/* Remove Cancel buttons - they should not exist */
.cancel-button,
button.cancel-button,
.dialog-button.cancel-button {
  display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .dialog-overlay {
    padding: 10px;
  }
  
  .dialog {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    margin: 10px auto;
    max-height: calc(100vh - 20px);
  }
  
  .dialog-header,
  .dialog-body,
  .dialog-content,
  .dialog-footer,
  .dialog-buttons {
    padding: 20px 15px;
  }
  
  .dialog-title {
    font-size: 20px;
    padding-right: 40px;
  }
  
  .dialog-close-button {
    top: 10px !important;
    right: 10px !important;
    width: 32px !important;
    height: 32px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 50% !important;
  }
  
  .dialog-footer,
  .dialog-buttons {
    flex-direction: column;
  }
  
  .dialog-button {
    width: 100%;
  }
}

/* Ensure dialogs override any theme colors */
.color-scheme-1 .dialog,
.color-scheme-2 .dialog,
.color-scheme-3 .dialog,
.color-scheme-4 .dialog,
.color-scheme-5 .dialog,
.color-scheme-6 .dialog {
  background: rgba(255, 255, 255, 0.98) !important;
  color: #333 !important;
  border: 2px solid #134F5C !important;
}

.color-scheme-1 .dialog-title,
.color-scheme-2 .dialog-title,
.color-scheme-3 .dialog-title,
.color-scheme-4 .dialog-title,
.color-scheme-5 .dialog-title,
.color-scheme-6 .dialog-title {
  color: #134F5C !important;
}
