/**
 * ============================================================================
 * SOLID'SERVE - Modal Form Styles
 * ============================================================================
 *
 * @file        modal-form.css
 * @description Standardized modal form layout and styling
 * @version     002
 *
 * ============================================================================
 */

/* =========================================
   ALERT DIALOG OVERRIDES FOR MODAL FORMS
   ========================================= */

/* Large modal size */
.alert-dialog.modal-lg {
  max-width: 680px;
  width: 95%;
}

/* Modal form container - clean slate inside alert-dialog */
.alert-dialog.modal-form-container {
  padding: 0;
}

.alert-dialog.modal-form-container .alert-body {
  padding: 0;
}

.alert-dialog.modal-form-container .alert-message {
  padding: 24px;
  text-align: left;
}

/* =========================================
   MODAL FORM CONTAINER
   ========================================= */

.modal-form {
  padding: 0;
}

.modal-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 0;
}

.modal-form-title {
  font-size: 22px;
  font-weight: 600;
  color: #1a56db;
  margin: 0;
  line-height: 1.3;
}

.modal-form-help {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--color-gray-400, #9ca3af);
  transition: color 150ms ease;
  border-radius: 50%;
}

.modal-form-help:hover {
  color: var(--color-primary, #2563eb);
  background: var(--color-primary-bg, #eff6ff);
}

/* =========================================
   FORM LAYOUT - TWO COLUMNS
   ========================================= */

.modal-form-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 40px;
  align-items: start;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding-right: 4px;
}

.modal-form-body.single-column {
  grid-template-columns: 1fr;
}

/* Full width fields span both columns */
.modal-form-field.full-width {
  grid-column: 1 / -1;
}

/* =========================================
   FORM FIELDS
   ========================================= */

.modal-form-field {
  margin-bottom: 22px;
}

.modal-form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #374151;
  margin-bottom: 10px;
}

.modal-form-label.required::before {
  content: '\2022';
  color: #dc2626;
  margin-right: 5px;
  font-size: 14px;
  line-height: 1;
  vertical-align: middle;
}

.modal-form-input,
.modal-form-select,
.modal-form-textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 14px;
  font-family: inherit;
  color: #374151;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 150ms ease;
  box-sizing: border-box;
}

.modal-form-input:focus,
.modal-form-select:focus,
.modal-form-textarea:focus {
  outline: none;
  background: white;
  border-color: #1a56db;
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.modal-form-input::placeholder,
.modal-form-select option[value=""] {
  color: #9ca3af;
}

.modal-form-input[readonly],
.modal-form-select[disabled] {
  background: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}

/* Select with custom arrow */
.modal-form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 44px;
  cursor: pointer;
}

.modal-form-select:hover {
  border-color: #cbd5e1;
}

/* Input with icon (date, password toggle, etc.) */
.modal-form-input-wrapper {
  position: relative;
}

.modal-form-input-wrapper .modal-form-input {
  padding-right: 44px;
}

.modal-form-input-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-gray-400, #9ca3af);
  pointer-events: none;
}

.modal-form-input-icon.clickable {
  pointer-events: auto;
  cursor: pointer;
}

.modal-form-input-icon.clickable:hover {
  color: var(--color-primary, #2563eb);
}

/* Textarea */
.modal-form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Hint text */
.modal-form-hint {
  font-size: 12px;
  color: var(--color-gray-500, #6b7280);
  margin-top: 6px;
}

/* =========================================
   RADIO AND CHECKBOX GROUPS
   ========================================= */

.modal-form-radio-group,
.modal-form-checkbox-group {
  display: flex;
  gap: 24px;
  padding-top: 4px;
}

.modal-form-radio,
.modal-form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-gray-700, #374151);
}

.modal-form-radio input,
.modal-form-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary, #2563eb);
}

/* =========================================
   FILE UPLOAD
   ========================================= */

.modal-form-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-primary, #2563eb);
  background: white;
  border: 1px solid var(--color-primary, #2563eb);
  border-radius: 8px;
  cursor: pointer;
  transition: all 150ms ease;
}

.modal-form-file-btn:hover {
  background: var(--color-primary-bg, #eff6ff);
}

.modal-form-file-hint {
  font-size: 12px;
  color: var(--color-gray-500, #6b7280);
  margin-top: 8px;
}

/* =========================================
   SUMMARY BOX
   ========================================= */

.modal-form-summary {
  grid-column: 1 / -1;
  background: var(--color-primary-bg, #eff6ff);
  border: 1px solid var(--color-primary-light, #93c5fd);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.modal-form-summary-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary-dark, #1d4ed8);
  margin-bottom: 12px;
}

.modal-form-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.modal-form-summary-item {
  text-align: center;
}

.modal-form-summary-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--color-gray-600, #4b5563);
  margin-bottom: 4px;
}

.modal-form-summary-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-primary, #2563eb);
}

/* =========================================
   MODAL FOOTER
   ========================================= */

.modal-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
  padding-top: 0;
  border-top: none;
}

.modal-form-btn {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 150ms ease;
  min-width: 90px;
}

.modal-form-btn-cancel {
  background: white;
  border: 1px solid #d1d5db;
  color: #374151;
}

.modal-form-btn-cancel:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.modal-form-btn-submit {
  background: #1a56db;
  border: 1px solid #1a56db;
  color: white;
}

.modal-form-btn-submit:hover {
  background: #1e40af;
  border-color: #1e40af;
}

/* =========================================
   HELP DIALOG
   ========================================= */

.help-dialog-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 200ms ease;
}

.help-dialog-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.help-dialog {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 200ms ease;
}

.help-dialog-backdrop.active .help-dialog {
  transform: scale(1);
}

.help-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-gray-200, #e5e7eb);
}

.help-dialog-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-gray-800, #1f2937);
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-dialog-close {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--color-gray-400, #9ca3af);
  border-radius: 4px;
}

.help-dialog-close:hover {
  background: var(--color-gray-100, #f3f4f6);
  color: var(--color-gray-600, #4b5563);
}

.help-dialog-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(80vh - 120px);
}

.help-dialog-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-gray-600, #4b5563);
}

.help-dialog-content h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-gray-800, #1f2937);
  margin: 16px 0 8px 0;
}

.help-dialog-content h4:first-child {
  margin-top: 0;
}

.help-dialog-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.help-dialog-content li {
  margin-bottom: 4px;
}

.help-dialog-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--color-gray-200, #e5e7eb);
  text-align: right;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 640px) {
  .modal-form-body {
    grid-template-columns: 1fr;
  }

  .modal-form-summary-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
