/* CSS Variables */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e5e5e5;
  --text: #1a1a1a;
  --text-secondary: #666;
  --text-muted: #999;
  --accent: #d4af37; /* Gold */
  --accent-hover: #b8860b; /* Darker Gold */
  --danger: #dc2626;
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 200ms ease;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Simple Nav */
.simple-nav {
  padding: 24px;
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

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

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.header-logo {
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.header-logo span {
  color: var(--accent);
}

/* Home Page */
.home {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  padding: 24px;
}

.home-content {
  width: 100%;
  max-width: 560px;
  text-align: center;
}

.home-logo {
  font-size: 56px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.home-logo span {
  color: var(--accent);
}

.home-tagline {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 48px;
}

.tagline-link {
  color: var(--accent);
  text-decoration: none;
  margin-left: 12px;
}

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

/* Search Form */
.search-form {
  margin-bottom: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 8px 8px 8px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: all var(--transition);
}

.search-box:focus-within {
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  border-color: var(--accent);
}

.search-box .search-icon {
  width: 22px;
  height: 22px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  padding: 14px 16px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  outline: none;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: all var(--transition);
}

.search-box button:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.search-box button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.search-box button svg {
  width: 20px;
  height: 20px;
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 16px;
}

/* Results Section */
.results-section {
  position: fixed;
  inset: 0;
  background: rgba(250,250,250,0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  z-index: 200;
}

.results-section[hidden] {
  display: none;
}

.results-card {
  position: relative;
  width: 100%;
  max-width: 700px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition);
}

.close-btn:hover {
  background: var(--border);
}

.close-btn svg {
  width: 18px;
  height: 18px;
}

.results-header {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.results-thumb {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
}

.results-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.results-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.results-channel {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.results-title {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
}

.results-summary {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.results-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

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

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

/* Library Page */
.library {
  max-width: 900px;
  margin: 0 auto;
  padding: 88px 24px 40px;
  height: 100vh;
  overflow-y: auto;
}

.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  gap: 24px;
  flex-wrap: wrap;
}

.library-header h1 {
  font-size: 28px;
  font-weight: 500;
}

.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.search-wrapper .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.search-wrapper input {
  width: 100%;
  padding: 12px 16px 12px 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
}

.search-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Video List */
.video-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.video-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity var(--transition);
}

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

.video-item:hover {
  opacity: 0.8;
}

.video-thumb {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.video-channel {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.video-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 6px;
  line-height: 1.4;
}

.video-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.video-preview {
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
}

.empty-state a {
  color: var(--accent);
  text-decoration: none;
}

.empty-state a:hover {
  text-decoration: underline;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.modal[hidden] {
  display: none;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
  overflow: hidden;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--border);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-header {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.modal-thumb {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
}

.modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: 48px;
}

.modal-channel {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.modal-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
}

.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 14px 20px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}

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

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.tab-content {
  display: none;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

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

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 600px) {
  .home-logo {
    font-size: 42px;
  }
  
  .home-tagline {
    font-size: 14px;
  }
  
  .tagline-link {
    display: block;
    margin-left: 0;
    margin-top: 8px;
  }
  
  .results-header {
    grid-template-columns: 1fr;
  }
  
  .results-thumb {
    width: 100%;
  }
  
  .results-actions {
    flex-direction: column;
  }
  
  .library-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .search-wrapper {
    max-width: 100%;
    width: 100%;
  }
  
  .video-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .modal-header {
    grid-template-columns: 1fr;
  }
  
  .modal-thumb {
    width: 100%;
  }
  
  .modal-meta {
    padding-right: 0;
  }
  
  .modal-footer {
    flex-direction: column;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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