/* ================================================================
 * 📄 File: style-modal.css
 * 🧩 Universal Modal System (v4.3 Final)
 * 🌐 Includes: Themed Confirm Modal + Overlay Fix + Responsive Design
 * 🧠 Works with ui-modal.js v4.3+
 * ================================================================ */

/* ============================================================
 * 🌑 UNIVERSAL OVERLAY (Normal + Confirm)
 * ============================================================ */
.mcqxam-modal-overlay,
#mcqxam-modal-overlay,
#mcqxamConfirmModal {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 999999 !important;
  display: none !important;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* 🟢 ACTIVE STATE */
.mcqxam-modal-overlay.active,
#mcqxam-modal-overlay.active,
#mcqxamConfirmModal.active {
  display: flex !important;
  visibility: visible;
  opacity: 1;
}

/* ============================================================
 * ⚙️ NORMAL MODAL (Universal)
 * ============================================================ */
.mcqxam-modal {
  background: #fff;
  border-radius: 14px;
  padding: 22px 26px;
  width: 460px;
  max-width: 94%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
  position: relative !important;
  border-top: 3px solid #0073aa;
  border-bottom: 2px solid #f1c40f;
  animation: modalFadeIn 0.3s ease;
  z-index: 1000000 !important;
}

/* ============================================================
 * ⚠️ CONFIRM MODAL BOX (Base)
 * ============================================================ */
.mcqxam-modal-box {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  width: 90%;
  max-width: 420px;
  animation: popIn 0.25s ease;
  z-index: 1000001 !important;
  overflow: hidden;
  text-align: center;
  padding: 22px;
}

/* ✨ Themed Content Structure */
.mcqxam-modal-box .modal-icon {
  font-size: 40px;
  margin-bottom: 10px;
}
.mcqxam-modal-box .modal-title {
  font-weight: 600;
  margin-bottom: 10px;
}
.mcqxam-modal-box .modal-message {
  font-size: 15px;
  color: #444;
}

/* ============================================================
 * 🎨 THEME COLORS (for Confirm Modals)
 * ============================================================ */
.mcqxam-modal-box.theme-danger .modal-icon,
.mcqxam-modal-box.theme-danger .modal-title { color: #e74c3c; }
.mcqxam-modal-box.theme-success .modal-icon,
.mcqxam-modal-box.theme-success .modal-title { color: #27ae60; }
.mcqxam-modal-box.theme-info .modal-icon,
.mcqxam-modal-box.theme-info .modal-title { color: #3498db; }
.mcqxam-modal-box.theme-warning .modal-icon,
.mcqxam-modal-box.theme-warning .modal-title { color: #f1c40f; }

/* ============================================================
 * 🔘 BUTTON STYLES
 * ============================================================ */
.mcqxam-modal-box .btn-theme {
  padding: 8px 20px;
  border-radius: 6px;
  border: 0;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.1s ease;
}
.mcqxam-modal-box .btn-theme:hover { opacity: 0.9; transform: scale(1.03); }

/* OK buttons by theme */
.mcqxam-modal-box.theme-danger #confirm-ok.btn-theme { background: #e74c3c; }
.mcqxam-modal-box.theme-success #confirm-ok.btn-theme { background: #27ae60; }
.mcqxam-modal-box.theme-info #confirm-ok.btn-theme { background: #3498db; }
.mcqxam-modal-box.theme-warning #confirm-ok.btn-theme { background: #f39c12; color: #000; }

/* Cancel button */
.mcqxam-modal-box #confirm-cancel {
  background: #ccc;
  color: #000;
  padding: 8px 20px;
  border-radius: 6px;
  margin-left: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.25s ease;
}
.mcqxam-modal-box #confirm-cancel:hover { background: #bfbfbf; }

/* ============================================================
 * 🧠 NORMAL MODAL HEADER/BODY/FOOTER
 * ============================================================ */
.mcqxam-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0073aa;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px 10px 0 0;
}
.mcqxam-modal-header h2 { font-size: 17px; font-weight: 600; margin: 0; }

.mcqxam-close-btn,
.close-modal {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.1s ease;
}
.mcqxam-close-btn:hover,
.close-modal:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.mcqxam-modal-body { padding: 20px; color: #222; line-height: 1.6; font-size: 15px; }
.mcqxam-modal-body label { display: block; margin-top: 8px; font-weight: 600; font-size: 13.5px; color: #333; }

.mcqxam-modal-body input,
.mcqxam-modal-body select,
.mcqxam-modal-body textarea {
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13.5px;
  color: #333;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.mcqxam-modal-body input:focus,
.mcqxam-modal-body select:focus,
.mcqxam-modal-body textarea:focus {
  border-color: #0073aa;
  box-shadow: 0 0 0 2px rgba(0,115,170,0.15);
  outline: none;
}

/* ============================================================
 * 💾 FOOTER BUTTONS
 * ============================================================ */
.mcqxam-modal-footer { padding: 10px 20px 20px; text-align: right; }
.mcqxam-modal-footer .btn,
.mcqxam-modal-body .btn {
  display: inline-block;
  background: #0073aa;
  color: #fff;
  border: none;
  padding: 8px 14px;
  font-size: 13.5px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.1s ease;
}
.mcqxam-modal-footer .btn:hover,
.mcqxam-modal-body .btn:hover { background: #005f8d; }
.mcqxam-modal-footer .btn.outline { background: #f1f1f1; color: #333; }
.mcqxam-modal-footer .btn.outline:hover { background: #ddd; }
.mcqxam-modal-footer .btn.primary { background: #0073aa; color: #fff; }

/* ============================================================
 * ⚙️ LOADERS
 * ============================================================ */
.modal-loader,
.confirm-loader {
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
}
.modal-loader.active,
.confirm-loader.active { display: flex; }

/* ============================================================
 * 🪄 ANIMATIONS
 * ============================================================ */
@keyframes modalFadeIn {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ============================================================
 * 🧱 FIX: Dashboard Layers (header/sidebar/footer)
 * ============================================================ */
.mcqxam-header-dash,
.mcqxam-sidebar,
.mcqxam-footer { z-index: 1000 !important; }
#wpadminbar { z-index: 999 !important; }

/* ============================================================
 * 📱 RESPONSIVE OPTIMIZATION
 * ============================================================ */
@media (max-width: 768px) {
  .mcqxam-modal,
  .mcqxam-modal-box {
    width: 92%;
    max-height: 90vh;
    border-radius: 10px;
    padding: 14px 16px;
  }
  .mcqxam-modal-header h2 { font-size: 15.5px; }
  .mcqxam-close-btn { font-size: 18px; }
}
