/* ============================================================
   Meeting Manager — Premium Dark Glassmorphism Theme
   Mobile-first responsive design
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */

:root {
  /* Colors */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(255, 255, 255, 0.15);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-indigo: #6366f1;
  --accent-violet: #8b5cf6;
  --accent-blue: #3b82f6;
  --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));

  /* Status Colors */
  --status-accepted: #22c55e;
  --status-proposed: #f59e0b;
  --status-pending: #6366f1;
  --status-declined: #ef4444;
  --status-error: #ef4444;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Layout */
  --header-height: 60px;
  --bottom-nav-height: 64px;
  --max-width: 640px;
}

/* ---------- Reset & Base ---------- */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
  z-index: -1;
  pointer-events: none;
}

/* ---------- App Shell ---------- */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ---------- Header ---------- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  height: var(--header-height);
  background: rgba(10, 14, 26, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; }
.header-right { display: flex; gap: var(--space-sm); }

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo h1 {
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Icon Buttons ---------- */

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-hover);
  color: var(--text-primary);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn.spinning svg {
  animation: spin 1s linear infinite;
}

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

/* ---------- Status Bar ---------- */

.status-bar {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.status-bar::-webkit-scrollbar { display: none; }

.status-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-error);
  transition: background 0.3s ease;
}

.status-chip.connected .status-dot {
  background: var(--status-accepted);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---------- Navigation Tabs ---------- */

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 var(--space-md);
  border-bottom: 1px solid var(--border-glass);
}

.tab {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.tab:hover { color: var(--text-secondary); }

.tab.active {
  color: var(--text-primary);
}

.tab.active::after {
  width: 60%;
}

/* Desktop: hide top tabs, show them. Mobile: hide top tabs, show bottom nav */
@media (min-width: 641px) {
  .bottom-nav { display: none; }
}

@media (max-width: 640px) {
  .tabs { display: none; }
}

/* ---------- Content Area ---------- */

.content {
  flex: 1;
  padding: var(--space-lg) var(--space-md);
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-xl));
}

@media (min-width: 641px) {
  .content {
    padding-bottom: var(--space-xl);
  }
}

.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.section-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--space-lg);
}

/* ---------- Panel Header + Filter Chips ---------- */

.panel-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.filter-chips {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.chip:hover {
  background: var(--bg-glass-hover);
  color: var(--text-secondary);
}

.chip.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

/* ---------- Meeting Cards ---------- */

.meetings-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.meeting-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all 0.3s ease;
  animation: slideIn 0.4s ease;
}

.meeting-card:hover {
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.meeting-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
}

.meeting-subject {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  margin-right: var(--space-sm);
}

.meeting-status {
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.meeting-status.accepted {
  background: rgba(34, 197, 94, 0.15);
  color: var(--status-accepted);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.meeting-status.proposed {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-proposed);
  border: 1px solid rgba(245, 158, 11, 0.3);
  animation: pulse-amber 2s ease-in-out infinite;
}

@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  50% { box-shadow: 0 0 8px 0 rgba(245, 158, 11, 0.2); }
}

.meeting-status.pending {
  background: rgba(99, 102, 241, 0.15);
  color: var(--status-pending);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.meeting-status.declined, .meeting-status.error, .meeting-status.needs_review {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-declined);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.meeting-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.meeting-detail {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.meeting-detail svg {
  flex-shrink: 0;
  opacity: 0.5;
}

.meeting-format-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.meeting-format-badge.vc {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}

.meeting-format-badge.in-person {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
}

.meeting-format-badge.hybrid {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.meeting-reason {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent-indigo);
  margin-bottom: var(--space-md);
}

.meeting-actions {
  display: flex;
  gap: var(--space-sm);
}

/* ---------- Empty State ---------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 1rem;
  font-weight: 500;
  margin-top: var(--space-md);
  color: var(--text-secondary);
}

.empty-state span {
  font-size: 0.85rem;
  margin-top: var(--space-sm);
  max-width: 280px;
}

.empty-state.hidden { display: none; }

/* ---------- Connect Cards ---------- */

.connect-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.connect-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
}

.connect-card:hover {
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-sm);
}

.connect-card.connected {
  border-color: rgba(34, 197, 94, 0.3);
}

.connect-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  flex-shrink: 0;
}

.connect-info {
  flex: 1;
}

.connect-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.connect-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.connect-status {
  font-size: 0.75rem;
  color: var(--status-error);
  margin-top: 4px;
  display: inline-block;
}

.connect-status.connected {
  color: var(--status-accepted);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-secondary);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.btn-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--status-accepted);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
  background: rgba(34, 197, 94, 0.25);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-declined);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-full { width: 100%; }

.btn-sm {
  padding: 5px 12px;
  font-size: 0.78rem;
}

/* ---------- Settings Form ---------- */

.settings-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.form-group 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 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Toggle switch */
.toggle-group {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  transition: all 0.3s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: white;
}

/* ---------- Bottom Navigation ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  height: var(--bottom-nav-height);
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
}

.bottom-nav-item:hover { color: var(--text-secondary); }

.bottom-nav-item.active {
  color: var(--accent-indigo);
}

.bottom-nav-item.active svg {
  filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.4));
}

/* ---------- Toast Notification ---------- */

.toast {
  position: fixed;
  top: calc(var(--header-height) + var(--space-md));
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 200;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px);
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: rgba(34, 197, 94, 0.3); }
.toast.error { border-color: rgba(239, 68, 68, 0.3); }
.toast.info { border-color: rgba(99, 102, 241, 0.3); }

/* ---------- Loading Skeleton ---------- */

.skeleton {
  background: linear-gradient(90deg, var(--bg-glass) 25%, rgba(255,255,255,0.06) 50%, var(--bg-glass) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Scrollbar Styling ---------- */

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-glass-hover);
}

/* ---------- Selection ---------- */

::selection {
  background: rgba(99, 102, 241, 0.3);
  color: white;
}
