:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --page-bg: #f1f5f9;
  --card-bg: #ffffff;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #1e293b;
  --sidebar-width: 260px;
  --radius: 14px;
  --radius-sm: 10px;
  --transition: 0.2s ease;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--page-bg);
  color: #1e293b;
  -webkit-font-smoothing: antialiased;
}

/* ===== LOGIN ===== */
.login-wrapper {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}
.card {
  width: 100%; max-width: 400px;
  padding: 36px 28px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fadeUp 0.5s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem; font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px; letter-spacing: -0.5px;
}
.subtitle { font-size: 0.9rem; color: #64748b; margin-bottom: 24px; }

.field { position: relative; margin-bottom: 14px; }
.field input {
  width: 100%; padding: 13px 44px 13px 14px;
  border: 1.5px solid #e2e8f0; border-radius: var(--radius-sm);
  background: #f8fafc; font-size: 0.95rem; font-family: inherit; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.toggle-password {
  position: absolute; top: 50%; right: 12px; transform: translateY(-50%);
  border: none; background: none; cursor: pointer;
  font-size: 1rem; color: #94a3b8; padding: 2px 6px;
}
.toggle-password:hover { color: var(--primary); }

.btn {
  width: 100%; padding: 13px; margin-top: 6px;
  font-size: 0.95rem; font-weight: 700; font-family: inherit;
  color: #fff; background: var(--primary); border: none;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: background var(--transition), transform 0.05s ease;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }

#message { margin-top: 14px; font-size: 0.88rem; font-weight: 500; min-height: 1.2em; }
.error { color: #dc2626; }
.success { color: #16a34a; }

/* ===== APP SHELL ===== */
.app-shell { display: flex; min-height: 100svh; }

/* ===== FLOATING MENU BUTTON ===== */
.fab-menu {
  position: fixed; bottom: 20px; left: 16px;
  width: 44px; height: 44px; z-index: 200;
  border: none; border-radius: 12px;
  background: var(--sidebar-bg);
  color: #fff; font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  display: grid; place-items: center;
  transition: background var(--transition), transform 0.1s ease, opacity 0.2s ease;
}
.fab-menu:hover { background: #1e293b; transform: scale(1.05); }
.fab-menu:active { transform: scale(0.95); }
.fab-menu.hidden { opacity: 0; pointer-events: none; }

/* ===== SIDEBAR (hidden by default) ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.open { transform: translateX(0); }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid #1e293b;
}
.sidebar-logo {
  width: 36px; height: 36px;
  background: var(--primary); color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 1.1rem;
  border-radius: 10px; display: grid; place-items: center;
}
.sidebar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 1.1rem; color: #fff;
  letter-spacing: -0.3px; flex: 1;
}
.sidebar-close {
  background: none; border: none; color: #64748b;
  font-size: 1.2rem; cursor: pointer; padding: 4px 8px;
  border-radius: 8px; transition: color var(--transition), background var(--transition);
}
.sidebar-close:hover { color: #fff; background: #1e293b; }

.sidebar-nav {
  flex: 1; padding: 12px 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); text-decoration: none;
  font-size: 0.9rem; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  border: none; background: none; cursor: pointer;
  width: 100%; font-family: inherit;
}
.nav-item i { font-size: 1rem; width: 20px; text-align: center; }
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active { background: var(--primary); color: #fff; }

.sidebar-footer { padding: 10px; border-top: 1px solid #1e293b; }
.logout-nav { color: #ef4444 !important; }
.logout-nav:hover { background: rgba(239,68,68,0.1) !important; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 250;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1; padding: 28px 32px; min-height: 100svh;
}

.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem; font-weight: 700; color: #0f172a; margin-bottom: 4px;
}
.page-desc { font-size: 0.9rem; color: #64748b; }

/* ===== DASHBOARD: ONE COLUMN MEETINGS ===== */
.meetings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
}

.meeting-box {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid #e2e8f0;
  background: #000;
  position: relative;
  min-height: 55vh;
}
.meeting-box iframe { width: 100% !important; height: 100% !important; }



/* Top-right controls wrapper */
.meeting-box-topright {
  position: absolute; top: 12px; left: 12px;
  display: flex; align-items: center; gap: 6px;
  z-index: 5;
  transition: left 0.3s ease;
}

.meeting-topright-btn {
  width: 28px; height: 28px;
  border: none; border-radius: 6px;
  background: rgba(15,23,42,0.8);
  color: #fff; font-size: 0.72rem;
  cursor: pointer;
  display: grid; place-items: center;
  backdrop-filter: blur(4px);
  text-decoration: none;
  transition: background 0.2s ease, transform 0.1s ease;
}
.meeting-topright-btn:hover {
  background: rgba(37,99,235,0.9);
  transform: scale(1.05);
}
.meeting-topright-btn:active {
  transform: scale(0.95);
}
.meeting-topright-btn.copied {
  background: rgba(22,163,74,0.9);
}

.meeting-box-participants {
  background: rgba(22,163,74,0.85);
  color: #fff; font-size: 0.72rem; font-weight: 600;
  padding: 4px 10px; border-radius: 8px;
  display: flex; align-items: center; gap: 5px;
}

.meeting-box-speaker {
  position: absolute; bottom: 12px; left: 12px;
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  cursor: pointer; z-index: 10;
  display: grid; place-items: center;
  font-size: 1rem; color: #fff;
  transition: background 0.2s ease, transform 0.1s ease, left 0.3s ease;
}
.meeting-box-speaker:active { transform: scale(0.9); }
.meeting-box-speaker.muted {
  background: rgba(239, 68, 68, 0.85);
}
.meeting-box-speaker.muted:hover {
  background: rgba(239, 68, 68, 1);
}
.meeting-box-speaker.unmuted {
  background: rgba(22, 163, 74, 0.85);
}
.meeting-box-speaker.unmuted:hover {
  background: rgba(22, 163, 74, 1);
}





.meeting-box-plist {
  position: absolute;
  bottom: 60px;
  left: 12px;
  right: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  z-index: 8;
  pointer-events: auto;
  transition: left 0.3s ease;
}

.pchip {
  background: rgba(15,23,42,0.85);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease;
}
.pchip:hover {
  background: rgba(220, 38, 38, 0.9);
}

.pchip .kick-btn {
  display: none;
  background: none;
  border: none;
  color: #fca5a5;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.pchip:hover .kick-btn {
  display: inline-flex;
  color: #fff;
}

.meeting-box.hidden-meeting { display: none; }

/* ===== MEETINGS PAGE ===== */
.create-meeting-card,
.meetings-list-card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px 28px; margin-bottom: 20px;
  max-width: 900px;
}
.create-meeting-card h2,
.meetings-list-card h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem; font-weight: 700; color: #0f172a;
  margin-bottom: 18px; display: flex; align-items: center; gap: 8px;
}
.create-meeting-card h2 i,
.meetings-list-card h2 i { color: var(--primary); }

.form-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.form-group { flex: 1; min-width: 200px; }
.form-group label {
  display: block; font-size: 0.82rem; font-weight: 500;
  color: #64748b; margin-bottom: 6px;
}
.form-group input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid #e2e8f0; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-family: inherit; background: #f8fafc; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1); background: #fff;
}
.form-group-btn { flex: 0 0 auto; min-width: auto; }
.btn-create {
  width: auto; padding: 11px 22px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.9rem; margin-top: 0;
}
.form-message { margin-top: 12px; font-size: 0.85rem; font-weight: 500; min-height: 1.2em; }

.meetings-list { display: flex; flex-direction: column; gap: 10px; }
.meeting-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: #f8fafc;
  border: 1px solid #e2e8f0; border-radius: var(--radius-sm);
  transition: box-shadow var(--transition);
}
.meeting-item:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }

.meeting-info { display: flex; flex-direction: column; gap: 2px; }
.meeting-display-name { font-weight: 600; font-size: 0.95rem; color: #0f172a; }
.meeting-room-name { font-size: 0.8rem; color: #64748b; font-family: 'Space Grotesk', monospace; }
.meeting-date { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }

.meeting-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm {
  padding: 7px 14px; font-size: 0.8rem; font-weight: 600;
  font-family: inherit; border: none; border-radius: 8px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--transition), transform 0.05s;
}
.btn-sm:active { transform: translateY(1px); }
.btn-join { background: var(--primary); color: #fff; }
.btn-join:hover { background: var(--primary-dark); }
.btn-delete { background: #fee2e2; color: #dc2626; }
.btn-delete:hover { background: #fecaca; }
.btn-copy { background: #e0f2fe; color: #0284c7; }
.btn-copy:hover { background: #bae6fd; }

.loading-text { text-align: center; color: #94a3b8; padding: 20px; }
.empty-state {
  text-align: center; color: #94a3b8; padding: 40px 20px;
  font-size: 0.95rem; max-width: 900px;
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: 12px; color: #cbd5e1; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .meetings-grid { grid-template-columns: 1fr; }
  .main-content { padding: 20px 16px; }
  .form-row { flex-direction: column; }
  .meeting-item { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* Shift controls to the right when Jitsi chat is open */
.meeting-box.chat-open .meeting-box-speaker {
  left: 320px; /* Move right of chat panel */
}

.meeting-box.chat-open .meeting-box-topright {
  left: 320px; /* Move right of chat panel */
}

.meeting-box.chat-open .meeting-box-plist {
  left: 320px; /* Move right of chat panel */
}

/* Let clicks pass through to Jitsi toolbar at bottom */
.meeting-box-speaker {
  pointer-events: auto;
}
.meeting-box-plist {
  pointer-events: none;
}
.meeting-box-plist .pchip {
  pointer-events: auto;
}


/* ===== HAND RAISE ===== */
.meeting-box-handraise {
  position: absolute; top: 12px; right: 12px;
  background: rgba(234, 179, 8, 0.95);
  color: #000; font-size: 0.75rem; font-weight: 700;
  padding: 6px 10px; border-radius: 10px;
  z-index: 6; pointer-events: auto;
  display: none; flex-direction: column; gap: 4px;
  backdrop-filter: blur(4px);
  animation: hand-pulse 1s ease infinite;
  max-width: 260px;
}
.meeting-box-handraise.visible {
  display: flex;
}

/* Individual hand raise chip */
.handraise-chip {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.12);
  padding: 4px 8px; border-radius: 6px;
  font-size: 0.75rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.handraise-chip span {
  overflow: hidden; text-overflow: ellipsis;
}

/* Resolve (checkmark) button */
.handraise-resolve-btn {
  background: rgba(0,0,0,0.2);
  border: none; color: #000;
  width: 20px; height: 20px; min-width: 20px;
  border-radius: 4px; cursor: pointer;
  display: grid; place-items: center;
  font-size: 0.7rem; font-weight: 700;
  transition: background 0.15s ease, transform 0.1s ease;
}
.handraise-resolve-btn:hover {
  background: rgba(22, 163, 74, 0.7);
  color: #fff;
  transform: scale(1.1);
}
.handraise-resolve-btn:active {
  transform: scale(0.9);
}
@keyframes hand-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(234, 179, 8, 0); }
}