/* ============================================================
   ENGAGEMENT CARD MODAL
   Centered overlay popup for announcements, polls, yes/no,
   feedback requests, and resource alerts.
   ============================================================ */

/* ── OVERLAY ──────────────────────────────────────────── */

.ec-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: ec-fade-in 0.2s ease forwards;
}

@keyframes ec-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── CARD ─────────────────────────────────────────────── */

.ec-card {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.05),
    0 12px 40px rgba(0,0,0,0.14),
    0 32px 80px rgba(0,0,0,0.12);
  overflow: hidden;
  animation: ec-slide-up 0.32s cubic-bezier(0.34, 1.38, 0.64, 1) forwards;
  position: relative;
}

@keyframes ec-slide-up {
  from { transform: translateY(28px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* Top accent bar per card type */
.ec-card::before {
  content: '';
  display: block;
  height: 5px;
  background: var(--ec-accent, #5B8DDB);
}

.ec-card[data-type="announcement"]   { --ec-accent: #5B8DDB; }
.ec-card[data-type="poll"]           { --ec-accent: #805AD5; }
.ec-card[data-type="yes_no"]         { --ec-accent: #38A169; }
.ec-card[data-type="feedback"]       { --ec-accent: #DD6B20; }
.ec-card[data-type="resource_alert"] { --ec-accent: #E53E3E; }

/* ── HEADER ───────────────────────────────────────────── */

.ec-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 0;
}

.ec-emoji {
  font-size: 34px;
  line-height: 1;
  display: block;
}

.ec-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #CBD5E0;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 8px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
  margin-top: -2px;
}

.ec-close:hover {
  color: #4A5568;
  background: #F7FAFC;
}

/* ── BODY ─────────────────────────────────────────────── */

.ec-body {
  padding: 12px 24px 18px;
}

.ec-title {
  font-size: 17px;
  font-weight: 700;
  color: #1A202C;
  margin: 0 0 8px;
  line-height: 1.35;
}

.ec-message {
  font-size: 15px;
  color: #4A5568;
  line-height: 1.65;
  margin: 0 0 18px;
}

/* ── POLL ─────────────────────────────────────────────── */

.ec-poll-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 6px;
}

.ec-poll-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #E2E8F0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #2D3748;
  background: #fff;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  font-family: inherit;
}

.ec-poll-option:hover:not(:disabled) {
  border-color: #9F7AEA;
  background: #FAF5FF;
  transform: translateX(3px);
}

.ec-poll-option:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Poll results */
.ec-poll-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 6px;
}

.ec-poll-result-item { display: flex; flex-direction: column; gap: 5px; }

.ec-poll-result-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: #4A5568;
}

.ec-poll-result-header.ec-selected { color: #805AD5; }

.ec-poll-bar-track {
  background: #EDF2F7;
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}

.ec-poll-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: #B794F4;
  width: 0%;
  transition: width 0.7s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.ec-poll-bar-fill.ec-selected { background: #6B46C1; }

/* ── YES / NO ─────────────────────────────────────────── */

.ec-yesno {
  display: flex;
  gap: 12px;
  margin-bottom: 6px;
}

/* ── FEEDBACK ─────────────────────────────────────────── */

.ec-feedback {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 6px;
}

.ec-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: #2D3748;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  line-height: 1.55;
}

.ec-textarea:focus {
  outline: none;
  border-color: #DD6B20;
  box-shadow: 0 0 0 3px rgba(221,107,32,0.12);
}

.ec-textarea.ec-error {
  border-color: #E53E3E;
  box-shadow: 0 0 0 3px rgba(229,62,62,0.12);
}

/* ── CTA WRAP ─────────────────────────────────────────── */

.ec-cta-wrap { margin-bottom: 6px; }

/* ── BUTTONS ──────────────────────────────────────────── */

.ec-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: transform 0.14s, filter 0.14s, box-shadow 0.14s;
  line-height: 1;
  font-family: inherit;
}

.ec-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.ec-btn:active:not(:disabled) {
  transform: translateY(0);
  filter: brightness(0.96);
}

.ec-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Primary — uses card accent color */
.ec-btn-primary {
  background: var(--ec-accent, #5B8DDB);
  color: #fff;
  width: 100%;
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

/* Yes */
.ec-btn-yes {
  flex: 1;
  background: #38A169;
  color: #fff;
  box-shadow: 0 3px 10px rgba(56,161,105,0.3);
}

/* No */
.ec-btn-no {
  flex: 1;
  background: #E53E3E;
  color: #fff;
  box-shadow: 0 3px 10px rgba(229,62,62,0.3);
}

/* ── FOOTER ───────────────────────────────────────────── */

.ec-footer {
  padding: 0 24px 18px;
  display: flex;
  justify-content: center;
}

.ec-dismiss {
  background: none;
  border: none;
  font-size: 13px;
  color: #A0AEC0;
  cursor: pointer;
  padding: 7px 18px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
  font-weight: 500;
  font-family: inherit;
}

.ec-dismiss:hover {
  color: #718096;
  background: #F7FAFC;
}

/* ── RESPONDED STATE ──────────────────────────────────── */

.ec-responded {
  text-align: center;
  padding: 10px 0 6px;
  animation: ec-fade-in 0.3s ease;
}

.ec-responded-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
  animation: ec-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ec-pop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.ec-responded-msg {
  font-size: 15px;
  font-weight: 600;
  color: #38A169;
  display: block;
}

/* ── MOBILE ───────────────────────────────────────────── */

@media (max-width: 480px) {
  .ec-card  { border-radius: 16px; }
  .ec-body  { padding: 10px 18px 16px; }
  .ec-footer { padding: 0 18px 16px; }
  .ec-emoji { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .ec-overlay, .ec-card,
  .ec-responded-icon { animation: none !important; }
  .ec-poll-bar-fill  { transition: none !important; }
}
