/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep:    #0f172a;
  --bg-card:    #1e293b;
  --bg-hover:   #263347;
  --border:     #334155;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --accent:     #3b82f6;
  --going:      #16a34a;
  --going-bg:   #14532d;
  --interested: #d97706;
  --int-bg:     #78350f;
  --none-bg:    #334155;
  --none-text:  #64748b;
  --radius:     6px;
}

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ===== Top Bar ===== */
#top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 48px;
}

#brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

#main-nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover { color: var(--text); background: var(--bg-card); }
.nav-link.active { color: var(--text); border-bottom: 2px solid var(--accent); border-radius: 0; }

/* ===== Filter Strip ===== */
#filter-strip {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

#filter-strip.hidden { display: none; }

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  padding: 0;
  min-width: 0;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.filter-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-pills .pill {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pills .pill:hover { border-color: var(--accent); color: var(--text); }
.filter-pills .pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===== Main Content ===== */
#main-content { padding: 20px; }

.view { }
.view.hidden { display: none; }

/* ===== Session Cards ===== */
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.session-type-group { margin-bottom: 28px; }
.session-type-heading {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding-left: 2px;
}

.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}

.session-card:hover { border-color: #475569; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  line-height: 1.3;
}

.card-speaker {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-badges {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.badge-day { background: #1e3a5f; color: #93c5fd; }
.badge-type { background: var(--bg-deep); color: var(--text-muted); border: 1px solid var(--border); }

/* Type-specific badge colors */
.badge-type-0 { background: #1e3a5f; color: #93c5fd; border: none; }
.badge-type-1 { background: #14532d; color: #86efac; border: none; }
.badge-type-2 { background: #78350f; color: #fcd34d; border: none; }
.badge-type-3 { background: #581c87; color: #d8b4fe; border: none; }
.badge-type-4 { background: #7f1d1d; color: #fca5a5; border: none; }
.badge-type-5 { background: #1e3a5f; color: #67e8f9; border: none; }

.card-description {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-description-wrapper { position: relative; }

.card-description.expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.desc-expand-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 0;
  display: block;
  margin-top: 2px;
}

.desc-expand-btn:hover { text-decoration: underline; }

.card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ===== Team Pills ===== */
.team-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  user-select: none;
}

.team-pill[data-status="none"] {
  background: var(--none-bg);
  color: var(--none-text);
}

.team-pill[data-status="interested"] {
  background: var(--int-bg);
  color: var(--interested);
}

.team-pill[data-status="going"] {
  background: var(--going-bg);
  color: #4ade80;
}

.team-pill:hover { filter: brightness(1.2); }

/* ===== Note Toggle ===== */
.note-toggle {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.note-toggle:hover { color: var(--text); }
.note-toggle.has-note { color: var(--accent); }

.note-area {
  display: none;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.note-area.open { display: block; }

.note-area textarea {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  padding: 8px;
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  line-height: 1.5;
}

.note-area textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state h3 { font-size: 16px; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 13px; }

/* ===== Schedule View ===== */
.schedule-container { overflow-x: auto; }

.schedule-grid {
  display: grid;
  grid-template-columns: 56px repeat(3, 1fr);
  min-width: 600px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.schedule-header {
  background: var(--bg-deep);
  padding: 10px 12px;
  font-weight: 700;
  font-size: 12px;
  color: var(--accent);
  text-align: center;
  border-bottom: 2px solid var(--border);
}

.schedule-header.time-col { color: var(--text-muted); }

.schedule-row {
  display: contents;
}

.schedule-time {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-deep);
  white-space: nowrap;
}

.schedule-cell {
  padding: 4px 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  min-height: 48px;
  position: relative;
}

.schedule-cell:last-child { border-right: none; }
.schedule-row:last-child .schedule-cell { border-bottom: none; }
.schedule-row:last-child .schedule-time { border-bottom: none; }

.schedule-cell.alt { background: #1a2535; }

.session-block {
  border-radius: 4px;
  padding: 5px 7px;
  margin-bottom: 3px;
  cursor: pointer;
  position: relative;
  transition: filter 0.15s;
}

.session-block:hover { filter: brightness(1.15); }

.session-block-title {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-block-members {
  font-size: 10px;
  margin-top: 2px;
  opacity: 0.8;
}

/* Session type colors for schedule blocks */
.type-color-0 { background: #1e3a5f; color: #93c5fd; border-left: 3px solid #3b82f6; }
.type-color-1 { background: #14532d; color: #86efac; border-left: 3px solid #16a34a; }
.type-color-2 { background: #78350f; color: #fcd34d; border-left: 3px solid #d97706; }
.type-color-3 { background: #581c87; color: #d8b4fe; border-left: 3px solid #9333ea; }
.type-color-4 { background: #7f1d1d; color: #fca5a5; border-left: 3px solid #ef4444; }
.type-color-5 { background: #1e3a5f; color: #67e8f9; border-left: 3px solid #06b6d4; }

/* ===== Tooltip ===== */
.tooltip {
  position: fixed;
  z-index: 1000;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 12px 14px;
  max-width: 280px;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.tooltip-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; color: #f1f5f9; }
.tooltip-speaker { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.tooltip-desc { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.tooltip-meta { font-size: 10px; color: #475569; margin-top: 6px; }
.tooltip.hidden { display: none; }

/* TBD section */
.tbd-section { margin-top: 28px; }
.tbd-section h3 { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.tbd-list { display: flex; flex-direction: column; gap: 6px; }
.tbd-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; font-size: 12px; }

/* ===== Settings ===== */
.settings-container { max-width: 560px; display: flex; flex-direction: column; gap: 16px; }

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.settings-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.settings-section-header h3 { font-size: 13px; font-weight: 700; }
.settings-section-header .toggle { color: var(--text-muted); font-size: 12px; }

.settings-section-body { padding: 0 16px 16px; border-top: 1px solid var(--border); }
.settings-section-body.hidden { display: none; }

.settings-row { display: flex; gap: 8px; margin-top: 12px; align-items: center; }

.settings-input {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  font-family: inherit;
}

.settings-input:focus { outline: none; border-color: var(--accent); }

.btn {
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: var(--radius);
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
  white-space: nowrap;
}

.btn:hover { filter: brightness(1.1); }
.btn.btn-secondary { background: var(--bg-deep); border: 1px solid var(--border); color: var(--text); }
.btn.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn.btn-danger { background: #7f1d1d; color: #fca5a5; border: 1px solid #ef4444; }

.team-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }

.team-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 13px;
}

.remove-member {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

.remove-member:hover { color: #ef4444; }

.settings-meta { font-size: 11px; color: var(--text-muted); margin-top: 8px; }

/* ===== Loading / Error ===== */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.error-msg { background: #7f1d1d; border: 1px solid #ef4444; border-radius: var(--radius); padding: 12px 16px; color: #fca5a5; font-size: 13px; margin-bottom: 16px; }

/* ===== Setup Modal ===== */
#setup-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#setup-modal.hidden {
  display: none;
}

/* Setup card (the inner dialog box) */
.setup-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.setup-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--text);
}

.setup-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 20px;
  line-height: 1.5;
}

/* Setup form elements */
.setup-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  padding: 9px 12px;
  margin-bottom: 12px;
}

.setup-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.setup-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.setup-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.setup-row .setup-input {
  flex: 1;
  margin-bottom: 0;
}

.setup-divider {
  color: var(--text-muted);
  font-size: 13px;
  margin: 14px 0 8px;
}

/* Team code display (the generated code shown prominently) */
.team-code-display {
  font-family: ui-monospace, 'Cascadia Code', 'Fira Mono', monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 20px;
  text-align: center;
  margin: 12px 0 20px;
}

/* Button variants */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ===== Sync Status Dot ===== */
.sync-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-left: 8px;
  flex-shrink: 0;
}

.sync-dot.connected {
  background: var(--going);
}

.sync-dot.hidden {
  display: none;
}

/* ===== Settings Additions ===== */
/* Settings team code inline display */
.settings-section .team-code-display {
  display: inline;
  font-family: ui-monospace, 'Cascadia Code', 'Fira Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

.settings-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ===== Light Mode ===== */
body.light-mode {
  --bg-deep:    #f8fafc;
  --bg-card:    #ffffff;
  --bg-hover:   #f1f5f9;
  --border:     #e2e8f0;
  --text:       #0f172a;
  --text-muted: #64748b;
  --accent:     #2563eb;
  --going:      #16a34a;
  --going-bg:   #dcfce7;
  --interested: #b45309;
  --int-bg:     #fef3c7;
  --none-bg:    #f1f5f9;
  --none-text:  #94a3b8;
}

body.light-mode .badge-day { background: #dbeafe; color: #1d4ed8; }
body.light-mode .badge-type-0 { background: #dbeafe; color: #1d4ed8; }
body.light-mode .badge-type-1 { background: #dcfce7; color: #15803d; }
body.light-mode .badge-type-2 { background: #fef3c7; color: #b45309; }
body.light-mode .badge-type-3 { background: #f3e8ff; color: #7e22ce; }
body.light-mode .badge-type-4 { background: #fee2e2; color: #b91c1c; }
body.light-mode .badge-type-5 { background: #cffafe; color: #0e7490; }
body.light-mode .type-color-0 { background: #dbeafe; color: #1e40af; border-left-color: #3b82f6; }
body.light-mode .type-color-1 { background: #dcfce7; color: #166534; border-left-color: #16a34a; }
body.light-mode .type-color-2 { background: #fef3c7; color: #92400e; border-left-color: #d97706; }
body.light-mode .type-color-3 { background: #f3e8ff; color: #6b21a8; border-left-color: #9333ea; }
body.light-mode .type-color-4 { background: #fee2e2; color: #991b1b; border-left-color: #ef4444; }
body.light-mode .type-color-5 { background: #cffafe; color: #155e75; border-left-color: #06b6d4; }
body.light-mode .session-card:hover { border-color: #94a3b8; }
body.light-mode .team-pill[data-status="going"] { color: #15803d; }

/* ===== Day / Time Grouping ===== */
.session-day-group { margin-bottom: 36px; }

.session-day-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.session-day-date {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}

.session-time-group { margin-bottom: 20px; }

.session-time-heading {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  padding-left: 2px;
}

/* ===== Location badge ===== */
.badge-location {
  background: var(--bg-deep);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 10px;
}

/* ===== List View ===== */
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 4px;
}

.list-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  transition: border-color 0.15s;
}

.list-row:hover { border-color: #475569; }

.list-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
}

.list-row-info {
  flex: 1;
  min-width: 0;
}

.list-row-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row-speaker {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.list-row-location {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.list-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ===== View Mode Toggle ===== */
.view-toggle-group { margin-left: auto; }

.view-mode-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.view-mode-btn {
  background: var(--bg-deep);
  border: none;
  color: var(--text-muted);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.view-mode-btn:hover { color: var(--text); background: var(--bg-hover); }
.view-mode-btn.active { background: var(--accent); color: #fff; }

/* ===== Theme Toggle Button ===== */
.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: var(--radius);
  line-height: 1;
  transition: background 0.15s;
}

.theme-toggle-btn:hover { background: var(--bg-card); }
