/* Global Styles - adapted from nownexttherapy.au */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Open Sans', sans-serif;
  line-height: 1.6;
  background: #f9f9f9;
  color: #333;
}

/* Navigation */
nav {
  background: #004c6d;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
}

nav ul li {
  margin: 0;
}

nav ul li a {
  display: block;
  color: white;
  text-decoration: none;
  padding: 1rem 1.5rem;
  transition: background-color 0.3s ease;
  font-size: 0.95rem;
}

nav ul li a:hover,
nav ul li a.active {
  background-color: #003c5a;
}

/* Mobile Navigation */
.mobile-nav-toggle {
  display: none;
  background: #004c6d;
  color: white;
  border: none;
  padding: 1rem;
  font-size: 1.2rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

/* Header */
header {
  background: #cfe0e8;
  padding: 2.5rem 2rem;
  text-align: center;
}

header h1 {
  color: #004c6d;
  margin: 0.5rem 0;
  font-size: 2rem;
}

header p {
  color: #003c5a;
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0.5rem auto;
}

/* Main Content */
main {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1rem;
  min-height: 60vh;
}

h1, h2 {
  color: #004c6d;
  margin-bottom: 1rem;
}

h2 {
  margin-top: 2rem;
}

p {
  margin-bottom: 1rem;
}

/* Buttons */
button, .btn {
  background-color: #004c6d;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 15px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: inline-block;
  text-decoration: none;
}

button:hover, .btn:hover {
  background-color: #003c5a;
}

/* Search Section */
.search-section {
  max-width: 800px;
  margin: 0 auto 2rem;
}

.search-box {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

.search-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.search-input-wrapper input {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-family: 'Open Sans', sans-serif;
  transition: border-color 0.3s;
}

.search-input-wrapper input:focus {
  outline: none;
  border-color: #004c6d;
}

.search-input-wrapper button {
  padding: 12px 24px;
  font-size: 16px;
  white-space: nowrap;
}

.clear-btn {
  background: #6c757d;
  padding: 12px 16px;
  font-size: 16px;
}

.clear-btn:hover {
  background: #545b62;
}

.search-filters {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.search-filters select {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  font-family: 'Open Sans', sans-serif;
}

.search-stats {
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Search Results */
.results-container {
  max-width: 800px;
  margin: 0 auto;
}

.result-card {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.result-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.result-thumbnail {
  width: 160px;
  min-width: 160px;
  height: 90px;
  border-radius: 4px;
  object-fit: cover;
  background: #e1ecf4;
}

.result-meta {
  flex: 1;
}

.result-meta h3 {
  color: #004c6d;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.result-meta h3 a {
  color: #004c6d;
  text-decoration: none;
}

.result-meta h3 a:hover {
  text-decoration: underline;
}

.result-interviewee {
  color: #003c5a;
  font-weight: 600;
  font-size: 0.9rem;
}

.result-date {
  color: #666;
  font-size: 0.85rem;
}

.result-matches {
  border-top: 1px solid #eee;
  padding-top: 0.75rem;
}

.match-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f5f5f5;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.match-item:hover {
  background: #f0f7fb;
}

.match-item:last-child {
  border-bottom: none;
}

.match-timestamp {
  color: #004c6d;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  text-decoration: none;
  padding: 2px 8px;
  background: #e1ecf4;
  border-radius: 4px;
  align-self: flex-start;
}

.match-timestamp:hover {
  background: #cfe0e8;
  text-decoration: none;
}

.match-text {
  font-size: 0.95rem;
  color: #555;
  line-height: 1.5;
}

.match-text mark {
  background: #fff3cd;
  padding: 1px 3px;
  border-radius: 2px;
  font-weight: 600;
}

/* Video Grid (Browse page) */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.video-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.video-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.video-card-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #e1ecf4;
  display: block;
}

.video-card-body {
  padding: 1rem;
}

.video-card-body h3 {
  color: #004c6d;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.video-card-body .interviewee {
  color: #003c5a;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.video-card-body .meta {
  color: #666;
  font-size: 0.8rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.video-card-body .meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.language-tag {
  background: #e1ecf4;
  color: #004c6d;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.caption-tag {
  background: #d4edda;
  color: #155724;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.no-caption-tag {
  background: #f8d7da;
  color: #721c24;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* Video Detail Page */
.video-detail {
  max-width: 900px;
  margin: 0 auto;
}

.video-player-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.video-player-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}

.video-info {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
}

.video-info h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.video-info .detail-meta {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.video-info .description {
  color: #555;
  line-height: 1.7;
  white-space: pre-line;
}

.transcript-section {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.transcript-section h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.transcript-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.transcript-search input {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: 'Open Sans', sans-serif;
}

.transcript-search input:focus {
  outline: none;
  border-color: #004c6d;
}

.transcript-body {
  max-height: 600px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.transcript-segment {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
  transition: background 0.2s;
}

.transcript-segment:hover {
  background: #f0f7fa;
}

.transcript-segment.active {
  background: #e1ecf4;
}

.transcript-segment.highlight {
  background: #fff3cd;
}

.segment-time {
  color: #004c6d;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  min-width: 50px;
  padding-top: 2px;
}

.segment-text {
  color: #333;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* About Page */
.about-content {
  max-width: 700px;
  margin: 0 auto;
}

.about-content section {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
}

.about-content h2 {
  margin-top: 0;
}

.about-content p {
  line-height: 1.8;
}

.about-content ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.about-content li {
  margin-bottom: 0.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.stat-card {
  text-align: center;
  padding: 1.5rem 1rem;
  background: #f0f7fa;
  border-radius: 8px;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: #004c6d;
  display: block;
}

.stat-label {
  color: #666;
  font-size: 0.9rem;
}

/* Theme Chips */
.themes-section {
  max-width: 800px;
  margin: 0 auto 2rem;
}

.themes-section h3 {
  color: #004c6d;
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
}

.theme-category {
  margin-bottom: 1.25rem;
}

.theme-category h4 {
  color: #555;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.theme-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.theme-chip {
  background: white;
  color: #004c6d;
  border: 1px solid #d0dde5;
  padding: 6px 14px;
  font-size: 0.88rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Open Sans', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-chip:hover {
  background: #004c6d;
  color: white;
  border-color: #004c6d;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 76, 109, 0.25);
}

.theme-count {
  font-size: 0.75rem;
  background: #e1ecf4;
  color: #004c6d;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}

.theme-chip:hover .theme-count {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Loading & Empty States */
.loading {
  text-align: center;
  padding: 3rem;
  color: #666;
}

.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid #e1ecf4;
  border-top-color: #004c6d;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

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

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #666;
}

.empty-state h3 {
  color: #004c6d;
  margin-bottom: 0.5rem;
}

/* Back Link */
.back-link {
  display: inline-block;
  color: #004c6d;
  text-decoration: none;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.back-link:hover {
  text-decoration: underline;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  background: #e1ecf4;
  margin-top: 2rem;
  color: #555;
  font-size: 0.9rem;
}

footer a {
  color: #004c6d;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 2rem 0;
}

.pagination button {
  padding: 8px 16px;
  font-size: 14px;
}

.pagination button.active {
  background: #003c5a;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
  .mobile-nav-toggle {
    display: block;
  }

  nav ul {
    display: none;
    flex-direction: column;
    width: 100%;
  }

  nav ul.show {
    display: flex;
  }

  nav ul li {
    width: 100%;
  }

  nav ul li a {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  header h1 {
    font-size: 1.5rem;
  }

  .search-input-wrapper {
    flex-direction: column;
  }

  .search-filters {
    flex-direction: column;
  }

  .search-filters select {
    width: 100%;
  }

  .result-header {
    flex-direction: column;
  }

  .result-thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  main {
    padding: 0 0.75rem;
  }
}
