/* ============================================
   Research Management System - Main Stylesheet
   Theme: Professional Blue & Red
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --primary: #1a3a6b;
  --primary-dark: #0f2347;
  --primary-light: #2d5ba3;
  --primary-xlight: #e8eef8;
  --accent: #c8102e;
  --accent-dark: #9e0d24;
  --accent-light: #e8415a;
  --accent-xlight: #fce8eb;
  --white: #ffffff;
  --grey-50: #f8f9fc;
  --grey-100: #f0f2f7;
  --grey-200: #e2e6ef;
  --grey-300: #c8cfe0;
  --grey-400: #9aa5c0;
  --grey-500: #6b7a99;
  --grey-600: #4a5568;
  --grey-700: #2d3748;
  --grey-800: #1a202c;
  --success: #0d7a4f;
  --success-light: #e6f4ef;
  --warning: #b45309;
  --warning-light: #fef3cd;
  --info: #0369a1;
  --info-light: #e0f2fe;
  --danger: #c8102e;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(26,58,107,0.10);
  --shadow-md: 0 4px 24px rgba(26,58,107,0.14);
  --shadow-lg: 0 8px 40px rgba(26,58,107,0.18);
  --transition: 0.2s ease;
  --font-main: 'DM Sans', sans-serif;
  --font-head: 'Sora', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--grey-50);
  color: var(--grey-700);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── TYPOGRAPHY ─── */
h1,h2,h3,h4,h5,h6 { font-family: var(--font-head); font-weight: 700; color: var(--primary-dark); }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }
p { margin-bottom: 0.5rem; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }

/* ─── LAYOUT ─── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--primary-dark);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.logo-wrap { display: flex; align-items: center; gap: 12px; }

.logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white; font-weight: 800;
  font-family: var(--font-head);
  flex-shrink: 0;
}

.logo-img {
  width: 42px; height: 42px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-text { color: white; }
.logo-text .name { font-family: var(--font-head); font-size: 0.95rem; font-weight: 700; line-height: 1.2; }
.logo-text .tagline { font-size: 0.68rem; opacity: 0.5; text-transform: uppercase; letter-spacing: 0.08em; }

.sidebar-nav { padding: 16px 0; flex: 1; }
.nav-section { margin-bottom: 8px; }
.nav-section-title {
  padding: 6px 20px 4px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  font-weight: 600;
  font-family: var(--font-head);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.65);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
  position: relative;
}

.nav-item:hover {
  color: white;
  background: rgba(255,255,255,0.06);
  border-left-color: rgba(255,255,255,0.2);
}

.nav-item.active {
  color: white;
  background: linear-gradient(90deg, rgba(200,16,46,0.25) 0%, rgba(200,16,46,0.05) 100%);
  border-left-color: var(--accent);
}

.nav-item i { width: 18px; font-size: 1rem; flex-shrink: 0; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius);
}

.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
}

.user-info .name { color: white; font-size: 0.8rem; font-weight: 600; line-height: 1.2; }
.user-info .role { color: rgba(255,255,255,0.4); font-size: 0.68rem; text-transform: capitalize; }
.user-card a { margin-left: auto; color: rgba(255,255,255,0.4); font-size: 1rem; }
.user-card a:hover { color: var(--accent-light); }

.powered-by-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 6px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}
.powered-by-strip:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.15);
}
.pb-text {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: color 0.2s;
}
.pb-text strong {
  color: rgba(255,255,255,0.55);
  font-weight: 600;
}
.powered-by-strip:hover .pb-text { color: rgba(255,255,255,0.55); }
.powered-by-strip:hover .pb-text strong { color: rgba(255,255,255,0.85); }
.pb-dots {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.pb-dots span {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: block;
}
.pb-dots span:nth-child(2) { background: rgba(255,255,255,0.12); }

/* ─── MAIN CONTENT ─── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
  box-shadow: 0 1px 8px rgba(26,58,107,0.06);
}

.topbar-title {
  flex: 1;
}

.topbar-title h2 { font-size: 1.1rem; font-weight: 700; color: var(--primary-dark); margin: 0; }
.topbar-title p { font-size: 0.75rem; color: var(--grey-400); margin: 0; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.topbar-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  background: var(--grey-100);
  border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--grey-600);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.topbar-btn:hover { background: var(--primary-xlight); color: var(--primary); }
.topbar-btn .notif-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  position: absolute;
  top: 7px; right: 7px;
  border: 2px solid white;
}

.page-body { padding: 28px; flex: 1; }

/* ─── CARDS ─── */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--grey-200);
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--grey-100);
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-header h3 { margin: 0; font-size: 0.95rem; }
.card-header .card-actions { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--grey-100); background: var(--grey-50); }

/* ─── STAT CARDS ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; margin-bottom: 28px; }

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--grey-200);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--primary);
}

.stat-card.accent::before { background: var(--accent); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: #f59e0b; }

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-xlight); color: var(--primary); }
.stat-icon.red { background: var(--accent-xlight); color: var(--accent); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: #fef3cd; color: #b45309; }

.stat-info { flex: 1; min-width: 0; }
.stat-info .value { font-size: 1.8rem; font-weight: 800; font-family: var(--font-head); color: var(--primary-dark); line-height: 1; }
.stat-info .label { font-size: 0.78rem; color: var(--grey-500); margin-top: 4px; }
.stat-info .change { font-size: 0.72rem; color: var(--success); font-weight: 600; margin-top: 3px; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,58,107,0.3); }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(200,16,46,0.3); }

.btn-outline { background: transparent; border: 1.5px solid var(--grey-300); color: var(--grey-600); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-xlight); }

.btn-outline-primary { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn-danger { background: var(--accent-xlight); color: var(--accent); }
.btn-danger:hover { background: var(--accent); color: white; }
.btn-success { background: var(--success-light); color: var(--success); }
.btn-success:hover { background: var(--success); color: white; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--grey-700);
  margin-bottom: 6px;
}
.form-label .required { color: var(--accent); margin-left: 3px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font-main);
  color: var(--grey-700);
  background: white;
  transition: all var(--transition);
  outline: none;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,58,107,0.08); }
.form-control:hover { border-color: var(--grey-300); }
.form-control.error { border-color: var(--accent); }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.75rem; color: var(--grey-400); margin-top: 4px; }
.form-error { font-size: 0.75rem; color: var(--accent); margin-top: 4px; display: none; }

.check-group { display: flex; flex-direction: column; gap: 10px; }
.check-item { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check-item input[type=checkbox],
.check-item input[type=radio] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.check-item label { font-size: 0.85rem; cursor: pointer; }

.toggle-switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-track {
  width: 40px; height: 22px;
  background: var(--grey-300);
  border-radius: 11px;
  transition: background var(--transition);
  position: relative;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-track { background: var(--primary); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(18px); }

/* ─── TABLES ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--grey-50);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--grey-500);
  border-bottom: 2px solid var(--grey-200);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--grey-100); transition: background var(--transition); }
tbody tr:hover { background: var(--grey-50); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 13px 16px; font-size: 0.875rem; color: var(--grey-700); }
tbody td strong { color: var(--primary-dark); font-weight: 600; }

/* ─── BADGES ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-active { background: var(--success-light); color: var(--success); }
.badge-draft { background: var(--grey-100); color: var(--grey-500); }
.badge-paused { background: var(--warning-light); color: var(--warning); }
.badge-closed { background: var(--accent-xlight); color: var(--accent); }
.badge-primary { background: var(--primary-xlight); color: var(--primary); }

/* ─── PROGRESS BAR ─── */
.progress-bar-wrap { background: var(--grey-100); border-radius: 20px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--primary-light), var(--primary)); transition: width 0.5s ease; }
.progress-bar.accent { background: linear-gradient(90deg, var(--accent-light), var(--accent)); }
.progress-bar.success { background: linear-gradient(90deg, #34d399, var(--success)); }

/* ─── SEARCH & FILTER BAR ─── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input-wrap { position: relative; flex: 1; min-width: 220px; }
.search-input-wrap i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--grey-400); font-size: 0.9rem; }
.search-input { padding-left: 38px !important; }

/* ─── TABS ─── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--grey-200); margin-bottom: 24px; }
.tab {
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--grey-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── MODALS ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,35,71,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  backdrop-filter: blur(3px);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--grey-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; background: white; z-index: 1;
}
.modal-header h3 { margin: 0; font-size: 1rem; }
.modal-close { width: 32px; height: 32px; border-radius: 6px; background: var(--grey-100); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--grey-500); font-size: 1.1rem; }
.modal-close:hover { background: var(--accent-xlight); color: var(--accent); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--grey-100); display: flex; gap: 10px; justify-content: flex-end; }

/* ─── ALERTS ─── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  border-left: 4px solid;
}
.alert-success { background: var(--success-light); color: var(--success); border-left-color: var(--success); }
.alert-error { background: var(--accent-xlight); color: var(--accent-dark); border-left-color: var(--accent); }
.alert-warning { background: var(--warning-light); color: var(--warning); border-left-color: #f59e0b; }
.alert-info { background: var(--info-light); color: var(--info); border-left-color: var(--info); }

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--grey-400);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; color: var(--grey-500); margin-bottom: 6px; }
.empty-state p { font-size: 0.85rem; }

/* ─── PAGINATION ─── */
.pagination { display: flex; gap: 6px; margin-top: 20px; align-items: center; justify-content: center; }
.page-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: white;
  border: 1.5px solid var(--grey-200);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--grey-600);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ─── CHART AREA ─── */
.chart-wrap { position: relative; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; justify-content: center; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--grey-600); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ─── LOGIN PAGE ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--primary-dark);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(200,16,46,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -150px; left: -150px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(45,91,163,0.3) 0%, transparent 70%);
  pointer-events: none;
}

.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  position: relative;
  z-index: 1;
}

.login-right {
  width: 460px;
  background: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 50px;
  position: relative;
  z-index: 1;
}

.login-brand { margin-bottom: 40px; }
.login-brand .logo-icon { width: 56px; height: 56px; font-size: 22px; margin-bottom: 20px; }
.login-brand .login-logo { width: 56px; height: 56px; margin-bottom: 20px; }
.login-brand h1 { color: white; font-size: 2.2rem; line-height: 1.2; margin-bottom: 12px; }
.login-brand h1 span { color: var(--accent-light); }
.login-brand p { color: rgba(255,255,255,0.5); font-size: 0.95rem; max-width: 400px; }

.login-features { display: flex; flex-direction: column; gap: 16px; }
.feature-item { display: flex; align-items: center; gap: 14px; }
.feature-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.7); font-size: 1rem; flex-shrink: 0; }
.feature-text .name { color: white; font-size: 0.88rem; font-weight: 600; }
.feature-text .desc { color: rgba(255,255,255,0.4); font-size: 0.78rem; }

.login-form-area { }
.login-form-area .head { margin-bottom: 32px; }
.login-form-area .head h2 { font-size: 1.6rem; color: var(--primary-dark); margin-bottom: 6px; }
.login-form-area .head p { color: var(--grey-400); font-size: 0.875rem; }
.login-submit { width: 100%; padding: 13px; margin-top: 8px; font-size: 0.95rem; border-radius: var(--radius); }

/* ─── SURVEY CARDS ─── */
.survey-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }

.survey-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--grey-200);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.survey-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.survey-card-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--grey-100);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.survey-card-title { font-size: 0.92rem; font-weight: 700; color: var(--primary-dark); line-height: 1.3; margin-bottom: 4px; }
.survey-card-cat { font-size: 0.72rem; color: var(--grey-400); text-transform: uppercase; letter-spacing: 0.06em; }

.survey-card-body { padding: 14px 20px; }
.survey-meta { display: flex; flex-direction: column; gap: 7px; }
.meta-item { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--grey-500); }
.meta-item i { width: 14px; color: var(--grey-400); }
.meta-item strong { color: var(--grey-700); font-weight: 600; }

.survey-progress { padding: 0 20px 16px; }
.survey-progress .label { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--grey-400); margin-bottom: 5px; }
.survey-progress .label strong { color: var(--primary); font-weight: 700; }

.survey-card-footer {
  padding: 12px 20px;
  background: var(--grey-50);
  border-top: 1px solid var(--grey-100);
  display: flex;
  gap: 8px;
}

/* ─── QUESTION BUILDER ─── */
.question-item {
  background: white;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.question-item:hover { border-color: var(--primary-light); box-shadow: var(--shadow); }
.question-item.active { border-color: var(--primary); }

.question-item-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--grey-50);
  cursor: pointer;
}

.q-drag { color: var(--grey-300); cursor: grab; font-size: 1.1rem; }
.q-number {
  width: 28px; height: 28px;
  background: var(--primary-xlight);
  color: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.q-text { flex: 1; font-size: 0.88rem; font-weight: 600; color: var(--grey-700); }
.q-type-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--grey-500);
  background: var(--grey-200);
  padding: 3px 8px;
  border-radius: 20px;
}
.q-required { color: var(--accent); font-size: 0.7rem; font-weight: 700; }
.q-actions { display: flex; gap: 6px; }
.q-btn { width: 28px; height: 28px; border-radius: 6px; border: none; background: white; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--grey-400); font-size: 0.9rem; transition: all var(--transition); }
.q-btn:hover { background: var(--accent-xlight); color: var(--accent); }
.q-btn.edit:hover { background: var(--primary-xlight); color: var(--primary); }

/* ─── ANALYTICS ─── */
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.analytics-grid.full { grid-template-columns: 1fr; }

.chart-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--grey-200);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chart-card-header { padding: 16px 20px; border-bottom: 1px solid var(--grey-100); }
.chart-card-header h4 { margin: 0; font-size: 0.88rem; font-weight: 700; color: var(--primary-dark); }
.chart-card-header p { margin: 2px 0 0; font-size: 0.75rem; color: var(--grey-400); }
.chart-card-body { padding: 20px; }

/* ─── PUBLIC SURVEY ─── */
.survey-public-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
}

.survey-public-card {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.survey-public-header {
  background: var(--primary-dark);
  padding: 32px;
  color: white;
}
.survey-public-header h1 { font-size: 1.5rem; color: white; margin-bottom: 8px; }
.survey-public-header p { color: rgba(255,255,255,0.7); font-size: 0.88rem; }
.survey-progress-bar { height: 4px; background: rgba(255,255,255,0.2); margin-top: 20px; border-radius: 2px; }
.survey-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s ease; }

.survey-public-body { padding: 32px; }
.question-block { margin-bottom: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--grey-100); }
.question-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.question-label { font-size: 0.95rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 4px; }
.question-desc { font-size: 0.82rem; color: var(--grey-400); margin-bottom: 14px; }
.question-req { color: var(--accent); font-size: 0.8rem; margin-left: 4px; }

.option-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1.5px solid var(--grey-200); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; transition: all var(--transition); }
.option-item:hover { border-color: var(--primary-light); background: var(--primary-xlight); }
.option-item input[type=radio],
.option-item input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; }
.option-item label { cursor: pointer; font-size: 0.88rem; flex: 1; }
.option-item.selected { border-color: var(--primary); background: var(--primary-xlight); }

.rating-wrap { display: flex; gap: 8px; flex-wrap: wrap; }
.rating-btn {
  width: 44px; height: 44px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  background: white;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--grey-600);
}
.rating-btn:hover, .rating-btn.selected { background: var(--primary); border-color: var(--primary); color: white; }

.survey-nav { display: flex; justify-content: space-between; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--grey-100); }

/* ─── SMS PANEL ─── */
.sms-template-preview {
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: white;
  position: relative;
  overflow: hidden;
}
.sms-template-preview::before { content: '📱'; position: absolute; right: 20px; top: 20px; font-size: 3rem; opacity: 0.2; }
.sms-bubble {
  background: white;
  color: var(--grey-700);
  padding: 14px 16px;
  border-radius: 12px 12px 12px 2px;
  font-size: 0.85rem;
  line-height: 1.6;
  margin-top: 14px;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ─── LOADING ─── */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--grey-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, var(--grey-100) 25%, var(--grey-50) 50%, var(--grey-100) 75%); background-size: 200% 100%; animation: skeleton-load 1.5s infinite; border-radius: var(--radius); }
@keyframes skeleton-load { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── QR CODE ─── */
.qr-wrap { text-align: center; padding: 20px; }
.qr-wrap canvas, .qr-wrap img { border-radius: var(--radius); box-shadow: var(--shadow); }

/* ─── BREADCRUMB ─── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--grey-400); margin-bottom: 20px; }
.breadcrumb a { color: var(--grey-400); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--grey-300); }
.breadcrumb .current { color: var(--primary-dark); font-weight: 600; }

/* ─── TOOLTIP ─── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--grey-800);
  color: white;
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ─── UTILITY ─── */
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-muted { color: var(--grey-400); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.ml-auto { margin-left: auto; }
.text-center { text-align: center; }

/* ─── TOAST NOTIFICATIONS ─── */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 300px;
  border-left: 4px solid;
  animation: slideInRight 0.3s ease;
  pointer-events: all;
}
.toast.success { border-left-color: var(--success); }
.toast.success i { color: var(--success); }
.toast.error { border-left-color: var(--accent); }
.toast.error i { color: var(--accent); }
.toast.info { border-left-color: var(--primary); }
.toast.info i { color: var(--primary); }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .login-left { display: none; }
  .login-right { width: 100%; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-body { padding: 16px; }
}
