/* CSS Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #222;
  background-color: #fafafa;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.2;
  margin-bottom: 0.5em;
  font-weight: 600;
}

h1 {
  font-size: 1.75em;
}
h2 {
  font-size: 1.5em;
}
h3 {
  font-size: 1.25em;
}

a {
  color: #0066cc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

/* Layout */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100%;
  display: flex;
  flex-direction: column;
}

header h1 {
  margin: 0;
  font-size: 1.25em;
}

.header-top {
  padding: 1rem 1rem 0.5rem;
  flex-shrink: 0;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.header-search input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 0.35rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  font-size: 0.9em;
  background-color: rgba(255, 255, 255, 0.9);
  color: #222;
}

.header-search input[type="text"]::placeholder {
  color: #999;
}

.header-search input[type="text"]:focus {
  outline: none;
  background-color: white;
  border-color: white;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.header-search .toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  font-size: 0.85em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.header-search .toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: white;
}

.keywords-toggle-btn {
  background: none;
  border: none;
  font-size: 1em;
  cursor: pointer;
  color: white;
  padding: 0.5rem;
  border-radius: 3px;
  transition: background-color 0.2s ease-in-out;
  white-space: nowrap;
}

.keywords-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 1rem;
  margin-top: 160px;
}

/* Schedule Items */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Time Group */
.time-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.time-group-header {
  font-size: 1.5em;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #667eea;
}

/* Talks Grid */
.talks-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.schedule-item {
  background: white;
  border-left: 4px solid #667eea;
  padding: 1rem;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  scroll-margin-top: 80px;
}

.schedule-item.general {
  border-left-color: #f59e0b;
  background-color: #fffbf0;
}

.schedule-item.talk {
  border-left-color: #667eea;
  position: relative;
}

.schedule-item.htmx-swapping {
  opacity: 0.6;
}

.schedule-item.htmx-settling {
  opacity: 1;
}

/* Time Badge */
.time-badge {
  display: inline-block;
  background-color: #667eea;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.schedule-item.general .time-badge {
  background-color: #f59e0b;
}

/* Title */
.schedule-item-title {
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #222;
}

/* Meta Information */
.schedule-item-meta {
  font-size: 0.9em;
  color: #555;
  margin-bottom: 0.5rem;
}

.schedule-item-meta > span {
  display: inline-block;
  margin-right: 1rem;
}

/* Bio and Summary */
.schedule-item-bio,
.schedule-item-summary {
  font-size: 0.9em;
  color: #666;
  margin-top: 0.5rem;
}

.schedule-item-label {
  font-weight: 600;
  color: #333;
  margin-right: 0.25rem;
}

/* Keywords */
.schedule-item-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.keyword-tag {
  display: inline-block;
  background-color: #e0e7ff;
  color: #667eea;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: 500;
}

.keyword-tag-interactive {
  background-color: #dbeafe;
  color: #0284c7;
  cursor: pointer;
  transition: all 0.2s ease;
}

.keyword-tag-interactive:hover {
  opacity: 0.8;
  transform: scale(1.05);
}

.keyword-tag-interactive.positive {
  background-color: #dcfce7;
  color: #16a34a;
}

.keyword-tag-interactive.negative {
  background-color: #fee2e2;
  color: #dc2626;
}

/* Keywords List (HTMX Panel) */
.keywords-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  margin-top: 0.5rem;
}

/* Keyword Score Display */
.keyword-score {
  font-size: 0.7em;
  font-weight: 600;
  margin-left: 0.25rem;
  opacity: 0.7;
}

.keyword-score.positive {
  color: #4ade80;
}

.keyword-score.negative {
  color: #f87171;
}

.keyword-list .keyword-score {
  display: none;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: #666;
}

.empty-state p {
  margin-bottom: 1rem;
}

/* HTMX Loading State */
.htmx-request .htmx-indicator {
  display: inline;
}

.htmx-indicator {
  display: none;
  margin-left: 0.5rem;
}

.htmx-indicator::after {
  content: "⟳";
  animation: spin 1s linear infinite;
}

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

/* Talk score highlighting */
/* Neutral score */
.schedule-item.talk.score-0 {
  /* Default styling */
}

/* Positive scores - purple tint intensifies with higher score */
.schedule-item.talk.score-1 {
  background-color: #f5f1ff;
  border-left-color: #a78bfa;
}

.schedule-item.talk.score-2 {
  background-color: #ede9fe;
  border-left-color: #a78bfa;
}

.schedule-item.talk.score-3 {
  background-color: #ddd6fe;
  border-left-color: #8b5cf6;
}

/* Negative scores - greyed out and dimmed */
.schedule-item.talk.score--1 {
  opacity: 0.7;
  background-color: #f5f5f5;
  border-left-color: #d1d5db;
}

.schedule-item.talk.score--2 {
  opacity: 0.5;
  background-color: #f5f5f5;
  border-left-color: #d1d5db;
}

.schedule-item.talk.score--3 {
  opacity: 0.35;
  background-color: #f5f5f5;
  border-left-color: #d1d5db;
}

/* Collapsible talk cards */
.talk-expand-toggle {
  display: none;
}

.talk-header {
  display: block;
  cursor: pointer;
  padding-right: 2rem;
}

.talk-details {
  display: none;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
  margin-top: 0.75rem;
}

.talk-expand-toggle:checked ~ .talk-details {
  display: block;
}

/* Favorite star */
.talk-favorite-toggle {
  display: none;
}

.talk-favorite {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 1.5em;
  cursor: pointer;
  color: #d1d5db;
  user-select: none;
  transition: color 0.2s ease-in-out;
}

.talk-favorite:hover {
  color: #fbbf24;
}

.talk-favorite-toggle:checked ~ .talk-favorite {
  color: #fbbf24;
}

/* Favorited talk card */
.schedule-item.talk:has(.talk-favorite-toggle:checked) {
  border-left-color: #fbbf24;
  border-left-width: 6px;
  box-shadow:
    0 0 0 1px #fbbf24,
    0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Mobile */
@media (max-width: 767px) {
  .header-top {
    display: none;
  }

  .container {
    margin-top: 110px;
  }
}

/* Tablet & Desktop */
@media (min-width: 768px) {
  .container {
    max-width: 900px;
    padding: 2rem;
    margin-top: 140px;
  }

  .talks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .schedule-item {
    padding: 1.5rem;
  }
}

@media (min-width: 1024px) {
  header {
    flex-direction: row;
    align-items: center;
    padding: 0.75rem 1rem;
  }

  .header-top {
    padding: 0;
    margin-right: 1.5rem;
  }

  .header-search {
    padding: 0;
    flex: 1;
  }

  .header-search input[type="text"] {
    flex: 0 1 400px;
  }

  .container {
    max-width: 1200px;
    margin-top: 100px;
  }

  .talks-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Touch-friendly tap targets */
button,
a,
.schedule-item {
  min-height: 44px;
}

input {
  min-height: 44px;
}
