/* Design Tokens - Modern, Minimalist, High-contrast, Professional */
:root {
  --bg-main: #0c0d0e;
  --bg-surface: #141518;
  --bg-subtle: #1c1e22;
  --bg-hover: #26292e;
  
  --border-subtle: #272a30;
  --border-focus: #4f535f;
  
  --text-primary: #f2f3f5;
  --text-secondary: #9aa0a6;
  --text-muted: #5f6368;
  
  --accent: #ffffff;
  --accent-contrast: #000000;
  --accent-blue: #3b82f6;
  --accent-danger: #ef4444;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  --font-family: 'Plus Jakarta Sans', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-main);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--text-primary);
  color: var(--accent-contrast);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.dot-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
}

/* Container */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  flex: 1;
  width: 100%;
}

/* Hero / Input Panel */
.input-panel {
  margin-bottom: 36px;
}

.headline {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.sub-headline {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.input-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
}

.input-card:focus-within {
  border-color: var(--border-focus);
}

.input-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.badge-tag {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}

#url-inputs {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.6;
  padding: 12px;
  outline: none;
  font-family: monospace;
  resize: vertical;
  min-height: 90px;
  transition: var(--transition);
}

#url-inputs:focus {
  border-color: var(--border-focus);
}

#url-inputs::placeholder {
  color: var(--text-muted);
  font-family: var(--font-family);
}

.input-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

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

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-primary:hover {
  opacity: 0.9;
}

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

.btn-loader {
  display: none;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-primary.loading .btn-loader {
  display: inline-block;
}
.btn-primary.loading .btn-text {
  display: none;
}

/* Alert */
.alert-box {
  margin-top: 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.selection-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.checkbox-container input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.btn-batch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--text-primary);
  color: var(--accent-contrast);
  border: none;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-batch:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-batch:not(:disabled):hover {
  opacity: 0.9;
}

/* Video Grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.video-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
}

.video-card:hover {
  border-color: var(--border-focus);
}

.video-card.selected {
  border-color: var(--text-primary);
  background: var(--bg-subtle);
}

.thumb-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
  overflow: hidden;
  cursor: pointer;
}

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.video-card:hover .thumb-img {
  transform: scale(1.02);
}

.card-select-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}

.card-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #fff;
}

.video-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
}

.card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.video-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}

.video-stats {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.card-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-card-dl {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  text-decoration: none;
}

.btn-card-dl:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

.btn-card-dl.downloading {
  opacity: 0.6;
  pointer-events: none;
}

/* Placeholder */
.placeholder-box {
  padding: 80px 24px;
  text-align: center;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.placeholder-icon {
  color: var(--text-muted);
}

.placeholder-text {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-focus);
  color: var(--text-primary);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 100;
  animation: slideUp 0.2s ease;
}

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

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

/* Footer */
.app-footer {
  padding: 20px;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .container {
    padding: 24px 16px;
  }
  .navbar {
    padding: 14px 16px;
  }
  .action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .btn-batch {
    justify-content: center;
  }
}
