/* ═══════════════════════════════════════════════════════════════
   CampusFlow — Premium Confirm Modal & Alert Toast
   Replaces native alert()/confirm() with themed UI components.
   Loaded in all 3 layouts: _Layout, _SidebarLayout, _AdminLayout
   ═══════════════════════════════════════════════════════════════ */

/* ── Confirm Modal — Backdrop ──────────────────────────────────── */
.edu-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .2s ease;
}
.edu-confirm-backdrop.edu-confirm-visible {
  opacity: 1;
}

/* ── Confirm Modal — Panel ─────────────────────────────────────── */
.edu-confirm-panel {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface-card-solid, #fff);
  border: 1px solid var(--border-soft, rgba(0,0,0,.08));
  border-radius: var(--radius-xl, 16px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .18), 0 0 0 1px rgba(0, 0, 0, .04);
  overflow: hidden;
  transform: scale(.92) translateY(12px);
  transition: transform .25s cubic-bezier(.22, .68, 0, 1.1), opacity .2s ease;
  opacity: 0;
}
.edu-confirm-visible .edu-confirm-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ── Icon area ─────────────────────────────────────────────────── */
.edu-confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 0.5rem;
  font-size: 1.35rem;
  flex-shrink: 0;
}
.edu-confirm-icon--danger {
  background: rgba(239, 68, 68, .1);
  color: #ef4444;
}
.edu-confirm-icon--warning {
  background: rgba(245, 158, 11, .1);
  color: #f59e0b;
}
.edu-confirm-icon--info {
  background: rgba(99, 102, 241, .1);
  color: #6366f1;
}
.edu-confirm-icon--success {
  background: rgba(34, 197, 94, .1);
  color: #22c55e;
}

/* ── Body ──────────────────────────────────────────────────────── */
.edu-confirm-body {
  padding: 1.5rem 1.5rem 1rem;
  text-align: center;
}
.edu-confirm-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main, #172033);
  margin: 0 0 0.4rem;
  line-height: 1.35;
}
.edu-confirm-message {
  font-size: .875rem;
  color: var(--text-muted, #64748b);
  margin: 0;
  line-height: 1.55;
  word-break: break-word;
}

/* ── Footer / Buttons ──────────────────────────────────────────── */
.edu-confirm-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.5rem 1.5rem;
  justify-content: center;
}
.edu-confirm-btn {
  flex: 1;
  max-width: 160px;
  padding: .55rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md, 10px);
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  text-align: center;
  line-height: 1.4;
}
.edu-confirm-btn:focus-visible {
  outline: 2px solid var(--brand-primary, #7C3AED);
  outline-offset: 2px;
}
/* Cancel */
.edu-confirm-btn--cancel {
  background: var(--surface-bg, #f1f5f9);
  color: var(--text-main, #172033);
  border-color: var(--border-soft, rgba(0,0,0,.08));
}
.edu-confirm-btn--cancel:hover {
  background: var(--surface-hover, #e2e8f0);
}
/* Confirm — Danger */
.edu-confirm-btn--danger {
  background: #ef4444;
  color: #fff;
}
.edu-confirm-btn--danger:hover {
  background: #dc2626;
  box-shadow: 0 2px 8px rgba(239, 68, 68, .3);
}
/* Confirm — Warning */
.edu-confirm-btn--warning {
  background: #f59e0b;
  color: #fff;
}
.edu-confirm-btn--warning:hover {
  background: #d97706;
  box-shadow: 0 2px 8px rgba(245, 158, 11, .3);
}
/* Confirm — Primary (info/default) */
.edu-confirm-btn--primary {
  background: var(--brand-primary, #7C3AED);
  color: #fff;
}
.edu-confirm-btn--primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 2px 8px rgba(124, 58, 237, .3);
}
/* Confirm — Success */
.edu-confirm-btn--success {
  background: #22c55e;
  color: #fff;
}
.edu-confirm-btn--success:hover {
  background: #16a34a;
  box-shadow: 0 2px 8px rgba(34, 197, 94, .3);
}

/* ── Alert Toast ───────────────────────────────────────────────── */
.edu-alert-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10600;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
  max-width: 380px;
  width: calc(100vw - 2rem);
}
.edu-alert-toast {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .75rem 1rem;
  background: var(--surface-card-solid, #fff);
  border: 1px solid var(--border-soft, rgba(0,0,0,.08));
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .14);
  pointer-events: auto;
  animation: eduAlertIn .3s cubic-bezier(.22, .68, 0, 1.1) both;
  position: relative;
  overflow: hidden;
}
.edu-alert-toast--exit {
  animation: eduAlertOut .25s ease forwards;
}
.edu-alert-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1rem;
  flex-shrink: 0;
}
.edu-alert-icon--warning {
  background: rgba(245, 158, 11, .12);
  color: #f59e0b;
}
.edu-alert-icon--danger {
  background: rgba(239, 68, 68, .12);
  color: #ef4444;
}
.edu-alert-icon--success {
  background: rgba(34, 197, 94, .12);
  color: #22c55e;
}
.edu-alert-icon--info {
  background: rgba(99, 102, 241, .12);
  color: #6366f1;
}
.edu-alert-msg {
  flex: 1;
  font-size: .84rem;
  font-weight: 500;
  color: var(--text-main, #172033);
  line-height: 1.4;
}
.edu-alert-close {
  background: none;
  border: none;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  padding: .2rem;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 4px;
  transition: color .15s;
}
.edu-alert-close:hover {
  color: var(--text-main, #172033);
}
.edu-alert-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 100%;
  transition: width linear;
}
.edu-alert-progress--warning { background: #f59e0b; }
.edu-alert-progress--danger  { background: #ef4444; }
.edu-alert-progress--success { background: #22c55e; }
.edu-alert-progress--info    { background: #6366f1; }

@keyframes eduAlertIn {
  from { opacity: 0; transform: translateX(20px) scale(.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes eduAlertOut {
  to { opacity: 0; transform: translateX(20px) scale(.95); }
}

/* ── Dark theme ────────────────────────────────────────────────── */
[data-theme="dark"] .edu-confirm-panel {
  background: var(--surface-card-solid, #1e293b);
  border-color: rgba(255, 255, 255, .06);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .04);
}
[data-theme="dark"] .edu-confirm-backdrop {
  background: rgba(0, 0, 0, .6);
}
[data-theme="dark"] .edu-confirm-btn--cancel {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .08);
}
[data-theme="dark"] .edu-confirm-btn--cancel:hover {
  background: rgba(255, 255, 255, .1);
}
[data-theme="dark"] .edu-alert-toast {
  background: var(--surface-card-solid, #1e293b);
  border-color: rgba(255, 255, 255, .06);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
}

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .edu-confirm-panel {
    max-width: 340px;
  }
  .edu-confirm-body {
    padding: 1.25rem 1.25rem .75rem;
  }
  .edu-confirm-footer {
    padding: 0 1.25rem 1.25rem;
  }
  .edu-confirm-btn {
    padding: .6rem .75rem;
    font-size: .82rem;
  }
}

/* ── Bootstrap modal isolation ─────────────────────────────────── */
/* Ensure Bootstrap modals always escape overflow-hidden/auto      */
/* containers (e.g. .table-responsive) that would clip them.       */
.modal {
  position: fixed !important;
  z-index: 1055;
}
.modal-backdrop {
  z-index: 1050;
}

/* ── Reduced motion ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .edu-confirm-panel,
  .edu-confirm-backdrop,
  .edu-alert-toast {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
