/* YouTube Clipper Styles */

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --accent: #e94560;
  --accent-hover: #ff6b6b;
  --text-primary: #eee;
  --text-secondary: #aaa;
  --text-muted: #666;
  --border: #333;
  --success: #4caf50;
  --warning: #ff9800;
  --error: #f44336;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

/* Identity Bar */
#identity-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.app-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

.version {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
  font-weight: 400;
}

.identity-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.clipper-label {
  color: var(--text-secondary);
}

.clipper-name {
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.clipper-name:hover {
  background: var(--bg-tertiary);
}

.identity-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.storage-status {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.storage-status.online {
  background: var(--success);
  color: white;
}

.storage-status.offline {
  background: var(--text-muted);
  color: var(--text-primary);
}

.storage-status.syncing {
  background: var(--warning);
  color: black;
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-secondary);
}

.btn-small {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.btn-small:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-icon {
  background: transparent;
  color: var(--text-primary);
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  font-size: 1.25rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: var(--bg-tertiary);
}

/* App Container */
.app-container {
  display: flex;
  height: calc(100vh - 52px);
  overflow: hidden;
}

/* Sidebars */
.sidebar, .clip-list-sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.clip-list-sidebar {
  border-right: none;
  border-left: 1px solid var(--border);
}

.sidebar.hidden {
  display: none;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

/* Playlist Items */
.playlist-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.playlist-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.playlist-item:hover {
  background: var(--bg-tertiary);
}

.playlist-item.active {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--accent);
}

.playlist-item img {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
}

.playlist-item-info {
  flex: 1;
  min-width: 0;
}

.playlist-item-title {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-duration {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1.5rem;
  gap: 1.5rem;
}

/* URL Input Section */
.url-input-section {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.url-input-section input {
  flex: 1;
  min-width: 300px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
}

.url-input-section input:focus {
  outline: none;
  border-color: var(--accent);
}

.example-buttons {
  display: flex;
  gap: 0.5rem;
}

/* Player Section */
.player-section {
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
}

#player-container {
  width: 100%;
  min-height: 480px;
  height: 50vh;
  max-height: 600px;
  background: #000;
}

#player,
#player iframe {
  width: 100% !important;
  height: 100% !important;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
}

#seek-bar {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
}

#seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

#current-time, #duration {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 50px;
}

/* Clip Editor Section */
.clip-editor-section {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 1.5rem;
}

.clip-editor-section h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.clip-times {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.time-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.time-input-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.time-input-group input {
  width: 120px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: monospace;
}

.duration-display {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.duration-display label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

#clip-duration {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: monospace;
  color: var(--accent);
}

/* Thumbnail Section */
.thumbnail-section {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

#thumbnail-preview {
  width: 160px;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
}

/* Notes Section */
.notes-section {
  margin-bottom: 1.5rem;
}

.notes-section label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

#clip-notes {
  width: 100%;
  min-height: 80px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
  resize: vertical;
}

#clip-notes:focus {
  outline: none;
  border-color: var(--accent);
}

/* Source Info */
.source-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.source-info label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.source-info input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Clip Actions */
.clip-actions {
  display: flex;
  gap: 0.75rem;
}

/* Clip List */
.clip-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.clip-list .empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

.clip-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: 4px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.clip-item:hover {
  transform: translateX(-2px);
}

.clip-item img {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
}

.clip-item-info {
  flex: 1;
  min-width: 0;
}

.clip-item-title {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.clip-item-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.clip-item-notes {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clip-item-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.clip-item-actions button {
  padding: 0.25rem;
  font-size: 0.75rem;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: 8px;
  min-width: 320px;
  max-width: 90%;
}

.modal-content h3 {
  margin-bottom: 1rem;
}

.modal-content p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.modal-content input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.modal-content input:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar, .clip-list-sidebar {
    width: 240px;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar, .clip-list-sidebar {
    width: 100%;
    max-height: 200px;
  }

  .main-content {
    padding: 1rem;
  }

  .url-input-section input {
    min-width: 100%;
  }

  .clip-times {
    flex-direction: column;
    gap: 1rem;
  }
}
