/*
 * Libongo Exam Manager - Plugin Styles
 * Extends the theme's base styles for plugin-specific components
 */

/* ===========================
   LOADING STATES
   =========================== */
.lem-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--lem-text-muted);
}

.lem-loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--lem-border);
  border-top-color: var(--lem-primary);
  border-radius: 50%;
  animation: lem-spin 0.7s linear infinite;
}

@keyframes lem-spin {
  to { transform: rotate(360deg); }
}

/* ===========================
   EXAM BUILDER STYLES
   =========================== */
.lem-exam-builder {
  background: var(--lem-surface);
  border: 1px solid var(--lem-border);
  border-radius: var(--lem-radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.lem-exam-builder__section {
  margin-bottom: 32px;
}

.lem-exam-builder__section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--lem-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lem-exam-builder__section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--lem-border);
}

/* Instructions list */
.lem-instruction-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.lem-instruction-row__num {
  width: 24px;
  height: 24px;
  background: var(--lem-primary-light);
  color: var(--lem-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Sections */
.lem-section-row {
  border: 1px solid var(--lem-border);
  border-radius: var(--lem-radius-md);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.lem-section-row__label {
  font-weight: 700;
  font-size: 0.88rem;
  min-width: 80px;
}

/* Question drag handles */
.lem-question-item {
  border: 1px solid var(--lem-border);
  border-radius: var(--lem-radius-md);
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--lem-surface);
  cursor: move;
  user-select: none;
  transition: all var(--lem-transition);
}

.lem-question-item:hover {
  border-color: var(--lem-primary);
  box-shadow: var(--lem-shadow-sm);
}

.lem-question-item__handle {
  color: var(--lem-border-strong);
  font-size: 1.1rem;
  padding-top: 2px;
  cursor: grab;
}

.lem-question-item__num {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--lem-primary);
  min-width: 24px;
}

.lem-question-item__content {
  flex: 1;
  font-size: 0.85rem;
  color: var(--lem-text-secondary);
  line-height: 1.5;
}

.lem-question-item__actions {
  display: flex;
  gap: 6px;
}

/* ===========================
   PRINT PREVIEW BUTTON
   =========================== */
.lem-print-preview-frame {
  position: fixed;
  inset: 0;
  background: rgba(26,21,35,0.7);
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lem-print-preview-inner {
  background: white;
  border-radius: var(--lem-radius-xl);
  width: 90vw;
  max-width: 900px;
  height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.lem-print-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--lem-border);
  background: var(--lem-bg-secondary);
}

.lem-print-preview-iframe {
  flex: 1;
  border: none;
  width: 100%;
}

/* ===========================
   AVATAR STACK
   =========================== */
.lem-avatar-stack {
  display: flex;
}

.lem-avatar-stack img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid white;
  margin-right: -8px;
  object-fit: cover;
}

/* ===========================
   SYMBOL PICKER
   =========================== */
.lem-symbol-btn {
  font-family: var(--lem-font-mono);
  font-size: 0.85rem;
  min-width: 30px;
  padding: 4px 6px;
  border-radius: var(--lem-radius-sm);
}

/* ===========================
   DRAG AND DROP
   =========================== */
.lem-dragging {
  opacity: 0.4;
}

.lem-drag-over {
  border-color: var(--lem-primary) !important;
  background: var(--lem-primary-light);
}

/* ===========================
   NOTICE ANIMATIONS
   =========================== */
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===========================
   WIDE DASHBOARD LAYOUT
   =========================== */
.lem-dashboard.lem-dashboard--wide {
  width: min(1900px, calc(100vw - 20px));
  margin-left: auto;
  margin-right: auto;
}

.lem-dashboard.lem-dashboard--wide .lem-main {
  max-width: 1720px;
  width: 100%;
}

.lem-dashboard.lem-dashboard--wide .lem-page-content {
  width: 100%;
}

@media (min-width: 1280px) {
  .lem-dashboard.lem-dashboard--wide {
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -49vw;
    margin-right: -49vw;
    width: 98vw;
    max-width: 1900px;
    padding-left: 8px;
    padding-right: 8px;
  }
}

@media (max-width: 1279px) {
  .lem-dashboard.lem-dashboard--wide {
    left: auto;
    right: auto;
    margin-left: auto;
    margin-right: auto;
    width: calc(100vw - 16px);
  }

  .lem-dashboard.lem-dashboard--wide .lem-main {
    max-width: 100%;
  }
}

/* Subscription page */
.lem-subscription__facts { display: flex; flex-wrap: wrap; gap: 32px; margin: 16px 0 0; }
.lem-subscription__facts dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--lem-text-muted, #6b6585); }
.lem-subscription__facts dd { margin: 4px 0 0; font-weight: 600; }
.lem-subscription__packages { display: grid; gap: 10px; margin-top: 8px; }
.lem-subscription__package { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid #e5e2f0; border-radius: 10px; cursor: pointer; }
.lem-subscription__package:has(input:checked) { border-color: #6d28d9; background: #f8f7ff; }
