/* Shared modal component.
 *
 * Originally lived inside profile.css and was only used as static HTML
 * rendered server-side after a profile update. Lifted here so any page
 * (vote.ejs, future admin tools, ...) can load this stylesheet and
 * either drop matching markup into the template OR drive it from JS via
 * /public/javascripts/modal.js.
 *
 * Markup contract (kept identical to the original profile.ejs version
 * so existing usages don't need to change):
 *
 *   <div class="modal" style="display: flex">
 *     <div class="modal-content">
 *       <div class="modal-header [success|error|confirm]">
 *         <h2>Title</h2>
 *       </div>
 *       <div class="modal-body">...</div>
 *       <div class="modal-footer">
 *         <button class="modal-btn">Primary</button>
 *         <button class="modal-btn modal-btn-secondary">Cancel</button>
 *       </div>
 *     </div>
 *   </div>
 */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(11, 12, 16, 0.8);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  animation: mbModalFadeIn 0.2s ease;
}

@keyframes mbModalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-content {
  background-color: #1f2833;
  border: 2px solid #66fcf1;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(102, 252, 241, 0.3);
  animation: mbModalSlideDown 0.2s ease;
  overflow: hidden;
}

@keyframes mbModalSlideDown {
  from { transform: translateY(-30px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.modal-header {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid #45a29e;
}

.modal-header.success {
  background-color: rgba(102, 252, 241, 0.1);
  border-bottom-color: #66fcf1;
}

.modal-header.error {
  background-color: rgba(255, 107, 107, 0.1);
  border-bottom-color: #ff6b6b;
}

.modal-header.confirm {
  background-color: rgba(102, 252, 241, 0.05);
  border-bottom-color: #45a29e;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
}

.modal-header.success h2 { color: #66fcf1; }
.modal-header.error   h2 { color: #ff6b6b; }
.modal-header.confirm h2 { color: #c5c6c7; }

.modal-body {
  padding: 25px;
  text-align: center;
  color: #c5c6c7;
  line-height: 1.6;
  font-size: 16px;
}

.modal-footer {
  padding: 15px 20px;
  text-align: center;
  border-top: 1px solid #45a29e;
  background-color: rgba(11, 12, 16, 0.3);
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.modal-btn {
  padding: 10px 24px;
  background-color: #66fcf1;
  border: none;
  border-radius: 5px;
  color: #0b0c10;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  font-family: inherit;
  min-width: 96px;
}

.modal-btn:hover,
.modal-btn:focus-visible {
  background-color: #45a29e;
  color: #c5c6c7;
  outline: none;
}

/* Secondary action (e.g. "Cancel" on a confirm dialog). Sits next to
 * the primary .modal-btn but visually de-emphasized so the user's eye
 * still lands on the primary action first. */
.modal-btn-secondary {
  background-color: transparent;
  color: #c5c6c7;
  border: 1px solid #45a29e;
}

.modal-btn-secondary:hover,
.modal-btn-secondary:focus-visible {
  background-color: rgba(69, 162, 158, 0.15);
  color: #66fcf1;
  outline: none;
}

/* Destructive variant for the primary button on confirm dialogs whose
 * action is a delete / unrecoverable change. */
.modal-btn-danger {
  background-color: #ff6b6b;
  color: #0b0c10;
}

.modal-btn-danger:hover,
.modal-btn-danger:focus-visible {
  background-color: #ff8a8a;
  color: #0b0c10;
  outline: none;
}
