/* =============================================
   MOODLE CREATOR - UCALP EDITION
   Palette: Navy Blue + Cardinal Red
   ============================================= */

:root {
  /* UCALP Brand Colors */
  --primary-900: #071B33;
  --primary-800: #0B2545;
  --primary-700: #13315C;
  --primary-600: #134074;
  --primary-500: #1B4F8A;
  --primary-400: #2E6DB4;
  --primary-300: #5A9BD5;
  --primary-200: #9DC3E6;
  --primary-100: #D0E4F5;
  --primary-50:  #EBF3FA;

  --accent-700: #8E1B1B;
  --accent-600: #B71C1C;
  --accent-500: #C62828;
  --accent-400: #E53935;
  --accent-300: #EF5350;
  --accent-200: #FFCDD2;
  --accent-100: #FFEBEE;

  --success-600: #2E7D32;
  --success-500: #43A047;
  --success-100: #E8F5E9;

  --warning-500: #F9A825;
  --warning-100: #FFF8E1;

  --neutral-900: #1A1D2E;
  --neutral-800: #2D3142;
  --neutral-700: #4A4E69;
  --neutral-600: #6B7185;
  --neutral-500: #888DA5;
  --neutral-400: #9CA3B4;
  --neutral-300: #BFC4D1;
  --neutral-200: #D5D9E2;
  --neutral-100: #E8EBF0;
  --neutral-50:  #F3F5F8;

  --surface: #F5F7FA;
  --card: #FFFFFF;
  --border: #E2E5ED;

  /* Typography */
  --font-display: 'Playfair Display', 'Georgia', serif;
  --font-body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(11,37,69,0.06), 0 1px 2px rgba(11,37,69,0.04);
  --shadow-md: 0 4px 12px rgba(11,37,69,0.08), 0 2px 4px rgba(11,37,69,0.04);
  --shadow-lg: 0 12px 40px rgba(11,37,69,0.12), 0 4px 12px rgba(11,37,69,0.06);
  --shadow-xl: 0 20px 60px rgba(11,37,69,0.15), 0 8px 20px rgba(11,37,69,0.08);

  /* Transitions */
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; width: 100%; }
body { 
  background: var(--surface); 
  font-family: var(--font-body);
  color: var(--neutral-900);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---- SCROLLBAR ---- */
* { scrollbar-width: thin; scrollbar-color: var(--neutral-300) transparent; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--neutral-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--neutral-400); }

/* ---- ANIMATIONS ---- */
@keyframes slideIn { from { transform: translateX(80px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100%{ opacity:1 } 50%{ opacity:.5 } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- BUTTONS ---- */
.mc-btn {
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  transition: all 0.2s var(--ease-out);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.mc-btn:hover { transform: translateY(-1px); }
.mc-btn:active { transform: translateY(0); }
.mc-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.mc-btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(19,49,92,0.3);
}
.mc-btn-primary:hover { box-shadow: 0 4px 16px rgba(19,49,92,0.4); }

.mc-btn-accent {
  background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(198,40,40,0.3);
}
.mc-btn-accent:hover { box-shadow: 0 4px 16px rgba(198,40,40,0.4); }

.mc-btn-ghost {
  background: var(--neutral-50);
  color: var(--neutral-700);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
}
.mc-btn-ghost:hover { background: var(--neutral-100); }

.mc-btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary-500);
  color: var(--primary-600);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}
.mc-btn-outline:hover { background: var(--primary-50); }

/* ---- INPUTS ---- */
.mc-input {
  background: var(--card);
  border: 1.5px solid var(--neutral-200);
  color: var(--neutral-900);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-body);
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.mc-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(27,79,138,0.12);
}
.mc-input::placeholder { color: var(--neutral-400); }
.mc-textarea { resize: vertical; min-height: 100px; }
.mc-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7185' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ---- CARDS ---- */
.mc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

/* ---- SIDEBAR ---- */
.mc-sidebar {
  width: 260px;
  border-right: 1px solid var(--border);
  background: var(--card);
  padding: 16px 12px;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.mc-section-btn {
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  font-size: 13px;
  text-align: left;
  transition: all 0.15s;
  display: block;
  width: 100%;
  background: transparent;
  color: var(--neutral-600);
  position: relative;
}
.mc-section-btn:hover { background: var(--neutral-50); color: var(--neutral-800); }
.mc-section-btn.active {
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 600;
  border-left: 3px solid var(--primary-600);
}

/* ---- ACTIVITY CARDS ---- */
.mc-act-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: all 0.15s var(--ease-out);
  cursor: default;
}
.mc-act-card:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow-md);
}

/* ---- ACTIVITY TYPE BUTTONS ---- */
.mc-type-btn {
  background: var(--neutral-50);
  border: 2px solid var(--neutral-200);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  font-family: var(--font-body);
  color: var(--neutral-800);
}
.mc-type-btn:hover { border-color: var(--primary-400); background: var(--primary-50); }
.mc-type-btn.selected { border-color: var(--primary-500); background: var(--primary-50); }

/* ---- MODALS ---- */
.mc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,27,51,0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
  backdrop-filter: blur(6px);
}
.mc-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 1100px;
  width: 94%;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.25s var(--ease-out);
  box-shadow: var(--shadow-xl);
}
.mc-modal-wide { max-width: 1200px; }
.mc-modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-800);
}

/* ---- HEADER ---- */
.mc-header {
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ---- FORM LABELS ---- */
.mc-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--neutral-600);
  display: block;
  margin-bottom: 6px;
}

/* ---- TAGS/BADGES ---- */
.mc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.mc-badge-primary { background: var(--primary-50); color: var(--primary-600); }
.mc-badge-accent { background: var(--accent-100); color: var(--accent-600); }
.mc-badge-success { background: var(--success-100); color: var(--success-600); }

/* ---- NOTIFICATION ---- */
.mc-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  padding: 14px 22px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s var(--ease-out);
  max-width: 400;
}
.mc-notification-success { background: var(--success-600); }
.mc-notification-error { background: var(--accent-500); }

/* ---- EMPTY STATE ---- */
.mc-empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--neutral-400);
  border: 2px dashed var(--neutral-200);
  border-radius: 16px;
}

/* ---- AI PANEL ---- */
.mc-ai-panel {
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  animation: fadeIn 0.2s;
}
.mc-ai-panel .mc-input:focus {
  border-color: var(--primary-500);
}

/* ---- FIELD GROUP ---- */
.mc-field-group {
  margin-bottom: 16px;
}
.mc-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---- TABS ---- */
.mc-tab {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  background: transparent;
  color: var(--neutral-500);
  transition: all 0.15s;
}
.mc-tab:hover { color: var(--neutral-800); background: var(--neutral-50); }
.mc-tab.active { 
  background: var(--primary-600); 
  color: #fff; 
  box-shadow: 0 2px 8px rgba(19,49,92,0.25);
}

/* ---- TEMPLATE CARD ---- */
.mc-template-card {
  background: var(--card);
  border: 1.5px solid var(--neutral-200);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.mc-template-card:hover {
  border-color: var(--primary-400);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ---- BG PATTERN ---- */
.mc-bg-pattern {
  position: fixed;
  inset: 0;
  opacity: 0.015;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, var(--primary-800) 1px, transparent 0);
  background-size: 32px 32px;
}

/* ---- DIVIDER ---- */
.mc-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ---- CHECKBOX ---- */
.mc-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--neutral-700);
}
.mc-checkbox-label input[type="checkbox"] {
  accent-color: var(--primary-600);
  width: 16px;
  height: 16px;
}

/* ---- TOOLTIP ---- */
.mc-tooltip {
  font-size: 12px;
  color: var(--neutral-500);
  font-style: italic;
  margin-top: 4px;
}

/* ---- STEP INDICATOR ---- */
.mc-step-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}
.mc-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neutral-300);
  transition: all 0.3s;
}
.mc-step-dot.active { 
  background: var(--primary-500); 
  width: 24px;
  border-radius: 4px;
}

/* ---- TINYMCE OVERRIDES ---- */
.tox-tinymce { border: 1.5px solid var(--neutral-200) !important; border-radius: 8px !important; }
.tox .tox-toolbar, .tox .tox-toolbar__overflow, .tox .tox-toolbar__primary { background: var(--neutral-50) !important; border-bottom-color: var(--neutral-100) !important; }
.tox .tox-toolbar-overlord { background: var(--neutral-50) !important; }
.tox .tox-statusbar { background: var(--card) !important; border-top-color: var(--neutral-100) !important; }
.tox .tox-statusbar__text-container { color: var(--neutral-400) !important; }
.tox .tox-tbtn { color: var(--neutral-600) !important; }
.tox .tox-tbtn:hover { background: var(--neutral-100) !important; color: var(--primary-600) !important; }
.tox .tox-tbtn--enabled, .tox .tox-tbtn--enabled:hover { background: var(--primary-50) !important; color: var(--primary-600) !important; }
.tox .tox-tbtn svg { fill: var(--neutral-600) !important; }
.tox .tox-tbtn:hover svg, .tox .tox-tbtn--enabled svg { fill: var(--primary-600) !important; }
.tox .tox-edit-area__iframe { background: var(--card) !important; }
.tox .tox-split-button:hover { box-shadow: none !important; }
.tox .tox-menu { background: var(--neutral-50) !important; border-color: var(--neutral-200) !important; }
.tox .tox-collection__item { color: var(--neutral-900) !important; }
.tox .tox-collection__item--active { background: var(--neutral-100) !important; }

/* ---- DRAG & DROP ---- */
.mc-act-card[draggable="true"] { transition: opacity 0.2s, border-color 0.2s; }
.mc-act-card[draggable="true"]:active { opacity: 0.5; }
.mc-section-btn { transition: opacity 0.2s; }
[draggable="true"]:active .mc-section-btn { opacity: 0.5; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .mc-modal { max-width: 92vw; }
  .mc-modal-wide { max-width: 94vw; }
}
@media (max-width: 768px) {
  .mc-sidebar { width: 200px; }
  .mc-field-row { grid-template-columns: 1fr; }
  .mc-modal { width: 98%; padding: 20px; }
}

/* ---- RESPONSIVE SCALING FOR LARGE MONITORS ---- */
/* Notebook/small desktop (<=1440px): base size (no changes) */
/* Medium desktop (1441-1919px): scale up 10% */
@media (min-width: 1441px) {
  #root { zoom: 1.08; }
  .mc-modal { max-width: 1000px; }
  .mc-modal-wide { max-width: 1300px; }
  .mc-sidebar { width: 290px; }
  .mc-header { height: 66px; }
}
/* Large desktop / 27" 1080p-1440p (1920px+): scale up 18% */
@media (min-width: 1920px) {
  #root { zoom: 1.15; }
  .mc-modal { max-width: 1100px; }
  .mc-modal-wide { max-width: 1400px; }
  .mc-sidebar { width: 310px; }
  .mc-header { height: 70px; }
  .mc-notification { top: 24px; right: 24px; padding: 16px 26px; font-size: 15px; max-width: 460px; }
}
/* Ultra-wide / 27" 4K (2560px+): scale up 30% */
@media (min-width: 2560px) {
  #root { zoom: 1.3; }
  .mc-modal { max-width: 1200px; }
  .mc-modal-wide { max-width: 1500px; }
  .mc-sidebar { width: 340px; }
  .mc-header { height: 76px; }
}
