:root {
  --primary: #0B5CFF;
  --primary-hover: #0A4FCC;
  --primary-light: #E6F0FF;
  --bg: #F7F9FA;
  --card: #FFFFFF;
  --text: #232333;
  --text-secondary: #6E7191;
  --border: #E0E3EB;
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #F44336;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --primary: #2D8CFF;
  --primary-hover: #4A9FFF;
  --primary-light: #1A2A4A;
  --bg: #0F1115;
  --card: #1A1D24;
  --text: #E4E6EB;
  --text-secondary: #A0A3B1;
  --border: #2A2D35;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* Header */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-actions { display: flex; gap: 12px; align-items: center; }

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--primary-light); border-color: var(--primary); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--text); font-size: 0.9rem; }
.form-input {
  width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 1rem; background: var(--card); color: var(--text); transition: 0.2s;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea.form-input { resize: vertical; min-height: 80px; }

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

/* Auth Page */
.auth-container {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-box {
  width: 100%; max-width: 420px;
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-box h1 { margin-bottom: 8px; font-size: 1.8rem; }
.auth-box p { color: var(--text-secondary); margin-bottom: 24px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; background: var(--bg); padding: 4px; border-radius: var(--radius-sm); }
.auth-tab { flex: 1; padding: 10px; border: none; background: transparent; color: var(--text-secondary); font-weight: 600; cursor: pointer; border-radius: var(--radius-sm); transition: 0.2s; }
.auth-tab.active { background: var(--card); color: var(--primary); box-shadow: 0 2px 6px rgba(0,0,0,0.08); }

/* Dashboard */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 2rem; margin-bottom: 8px; }
.page-header p { color: var(--text-secondary); }
.actions-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }

/* Meeting Cards (Zoom Style) */
.meeting-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.meeting-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden; transition: 0.2s;
}
.meeting-card::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--primary); }
.meeting-card:hover { box-shadow: var(--shadow-hover); }
.meeting-status {
  display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; margin-bottom: 12px;
}
.status-upcoming { background: var(--primary-light); color: var(--primary); }
.status-live { background: #E8F5E9; color: var(--success); }
.status-ended { background: var(--bg); color: var(--text-secondary); }
.meeting-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; }
.meeting-meta { display: flex; gap: 16px; color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 16px; flex-wrap: wrap; }
.meeting-actions { display: flex; gap: 8px; margin-top: 16px; }

/* Modals */
.modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  z-index: 1000; align-items: center; justify-content: center; padding: 24px; opacity: 0; transition: 0.3s;
}
.modal.active { display: flex; opacity: 1; }
.modal-content {
  background: var(--card); border-radius: var(--radius); width: 100%; max-width: 500px;
  box-shadow: var(--shadow-hover); transform: scale(0.95); transition: 0.3s;
}
.modal.active .modal-content { transform: scale(1); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; font-size: 1.3rem; }
.modal-close { background: none; border: none; font-size: 1.8rem; cursor: pointer; color: var(--text-secondary); line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  color: var(--text);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  border-left: 4px solid var(--success);
  z-index: 9999;
  animation: slideIn 0.3s;
}
.toast.error {
  border-left-color: var(--danger);
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Utilities */
.hidden { display: none !important; }
.flex-gap { display: flex; gap: 12px; align-items: center; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.loading { text-align: center; padding: 40px; color: var(--text-secondary); }

/* Responsive */
@media (max-width: 768px) {
  .meeting-grid { grid-template-columns: 1fr; }
  .actions-bar { flex-direction: column; align-items: stretch; }
  .modal-content { max-width: 95%; }
}

/* Room Grid Responsive */
@media (max-width: 1024px) {
  .room-grid { grid-template-columns: 1fr !important; }
  .card { position: static !important; }
  #editor { height: 400px !important; }
}

/* Quill Dark Mode Support */
[data-theme="dark"] .ql-toolbar { background: var(--card); border-color: var(--border); }
[data-theme="dark"] .ql-container { background: var(--card); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .ql-stroke { stroke: var(--text-secondary) !important; }

/* === CHAT & REACTIONS === */
.chat-panel {
  display: flex; flex-direction: column; height: 100%;
  border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px;
}
.chat-messages {
  flex: 1; overflow-y: auto; max-height: 300px; padding: 8px 0;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.chat-msg { display: flex; gap: 10px; margin-bottom: 12px; }
.chat-avatar {
  width: 28px; height: 28px; background: var(--primary-light); color: var(--primary);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600; flex-shrink: 0;
}
.chat-bubble {
  background: var(--bg); padding: 8px 12px; border-radius: 12px 12px 12px 4px;
  font-size: 0.9rem; line-height: 1.4;
}
.chat-input-wrap { display: flex; gap: 8px; margin-top: 8px; }
.chat-input { flex: 1; padding: 10px; border: 1px solid var(--border); border-radius: 20px; font-size: 0.9rem; }
.reactions { display: flex; gap: 6px; margin-top: 8px; }
.reaction-btn {
  background: none; border: 1px solid var(--border); border-radius: 16px;
  padding: 4px 10px; cursor: pointer; font-size: 1.1rem; transition: 0.2s;
}
.reaction-btn:hover { background: var(--primary-light); transform: scale(1.1); }

/* === AGENDA === */
.agenda-list { list-style: none; margin-top: 12px; }
.agenda-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.agenda-check { width: 18px; height: 18px; cursor: pointer; }
.agenda-text { flex: 1; font-size: 0.9rem; }
.agenda-text.done { text-decoration: line-through; color: var(--text-secondary); }
.agenda-timer { font-size: 0.8rem; color: var(--primary); font-weight: 600; }

/* === POLLING === */
.poll-widget { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.poll-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer;
}
.poll-bar-bg {
  flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden;
}
.poll-bar { height: 100%; background: var(--primary); transition: width 0.3s; }
.poll-count { font-size: 0.85rem; color: var(--text-secondary); min-width: 30px; text-align: right; }

/* === SEARCH & FILTER === */
.search-bar {
  display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap;
}
.search-input { flex: 1; min-width: 200px; }
.filter-select { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); color: var(--text); }
[data-theme="dark"] .ql-fill { fill: var(--text-secondary) !important; }
[data-theme="dark"] .ql-picker { color: var(--text-secondary) !important; }
