/* public/css/modal.css */

/**
 * Modal overlay covers entire viewport and blocks interaction when visible.
 * Hidden by default, fully removed from layout and pointer events.
 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/**
 * When overlay is active (.active), show and allow interaction.
 */
.modal-overlay.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/**
 * Hidden helper: remove any element from layout and disable pointer events.
 */
.hidden {
  display: none !important;
  pointer-events: none !important;
}

/* Modal card container */
.modal {
  background: #1E2630;          /* Dark dashboard match */
  color: #ECECEC;               /* Light text */
  border-radius: 0.75rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 480px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  outline: none;
  animation: slideDown 0.4s ease;
}

/* Slide-down entrance */
@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

/* Header section */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.modal-header h2 {
  font-size: 1.5rem;
  margin: 0;
  color: #FFFFFF;               /* Pure white title */
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: #ECECEC;
  cursor: pointer;
  transition: color 0.2s;
}
.modal-close:hover {
  color: #E67E22;               /* Orange hover */
}

/* Body layout */
.modal-body {
  display: grid;
  grid-gap: 1rem;
}
.modal-body label {
  display: flex;
  flex-direction: column;
  font-size: 0.95rem;
  color: #ECECEC;
}
.modal-body input,
.modal-body select {
  background: #2A2F38;          /* Input panel color */
  color: #ECECEC;
  border: 1px solid #444C56;
  border-radius: 0.375rem;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-body input:focus,
.modal-body select:focus {
  border-color: #7289DA;        /* Bright blue focus */
  box-shadow: 0 0 0 3px rgba(114,137,218,0.3);
  outline: none;
}

/* Footer buttons container */
.modal-footer {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #444C56;
  background: #252A33;
}

/* Buttons */
.btn-cancel,
.btn-save {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

/* Destructive (“Cancel”) button */
.btn-cancel {
  background: #E74C3C;          /* Soft red */
  color: #FFFFFF;
}
.btn-cancel:hover {
  background: #C0392B;
}

/* Primary (“Save”) button */
.btn-save {
  background: #E67E22;          /* GuildOps orange */
  color: #FFFFFF;
}
.btn-save:hover {
  background: #CF6B1B;
}


/* ------------------------------------------------------------------
   Template modal – horizontal role rows
   ------------------------------------------------------------------ */

#tpl-modal-overlay .modal-body .role-list .role-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

/* Role name field expands to fill available space */
#tpl-modal-overlay .modal-body .role-list .role-row input[name="role_key"] {
  flex: 1;
}

/* Emoji & limit inputs get fixed width */
#tpl-modal-overlay .modal-body .role-list .role-row input[name="emoji"],
#tpl-modal-overlay .modal-body .role-list .role-row input[name="limit"] {
  flex: none;
  width: 4rem;
}

/* Tweak the delete-icon button size & spacing */
#tpl-modal-overlay .modal-body .role-list .role-row .role-delete {
  flex: none;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

/* On hover, make the trash icon pop */
#tpl-modal-overlay .modal-body .role-list .role-row .role-delete:hover {
  background-color: rgba(231, 76, 60, 0.1);
}
