/* Organizer Module Styles - modern, mobile-first */
:root {
  --bg: #f7f9fc;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #0d6efd;
  --danger: #dc3545;
  --success: #16a34a;
  --accent: linear-gradient(135deg, #7c4dff, #00c2ff);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

.header {
  max-width: 1200px;
  margin: 16px auto 8px;
  padding: 0 16px;
}

h1 { font-size: 1.5rem; margin: 8px 0 12px; }
.muted { color: var(--muted); font-size: 0.95rem; }

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-accent { background: var(--accent); border: none; color: #fff; }
.btn-small { padding: 6px 10px; font-size: 0.9rem; }

.input, .search {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: #fff;
}
.search { width: 100%; max-width: 480px; }

.wrapper {
  max-width: 1200px;
  margin: 10px auto 24px;
  padding: 0 16px;
}

.columns {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

.sidebar, .content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.sidebar {
  padding: 12px;
  position: sticky;
  top: 16px;
  align-self: start;
}
.sidebar .section-title { font-weight: 700; margin-bottom: 8px; }

.group-form { display: flex; gap: 8px; margin-bottom: 12px; }

.groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 240px);
  overflow: auto;
}

.group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.group-title { font-weight: 600; }
.group-meta { color: var(--muted); font-size: 0.85rem; }
.group-actions { display: inline-flex; gap: 6px; }

.drop-target {
  border: 2px dashed transparent;
  border-radius: 10px;
}
.drop-target.dragover {
  border-color: var(--primary);
  background: rgba(13, 110, 253, 0.06);
}

.content { padding: 12px; }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.channel-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: grab;
  position: relative;
}
.channel-card:active { cursor: grabbing; }
.channel-card img { width: 100%; height: 100px; object-fit: contain; background: #f2f4f7; border-radius: 8px; }
.channel-name { font-weight: 600; font-size: 0.98rem; }
.channel-badge { font-size: 0.8rem; color: var(--muted); }
.channel-actions { display: flex; gap: 8px; margin-top: 4px; }

/* Selected state for multi-select */
.channel-card.selected {
  outline: 2px solid var(--primary);
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.08);
}

/* Checkbox overlay for selection */
.select-toggle {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 4px;
  z-index: 2;
}
.select-input { accent-color: var(--primary); width: 16px; height: 16px; }

/* Overlay Play button on channel logos */
.channel-logo-container {
  position: relative;
  height: 100px;
  background: #f2f4f7;
  border-radius: 8px;
  overflow: hidden;
}
.channel-logo-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.channel-logo-container .play-button {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  border: none;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
}
.channel-logo-container:hover .play-button,
.channel-logo-container:focus-within .play-button {
  opacity: 1;
}
.channel-logo-container .play-button:hover {
  background: rgba(0, 0, 0, 0.35);
}
.channel-logo-container .play-button svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}
/* Visible focus ring for keyboard users */
.channel-logo-container .play-button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.6);
  opacity: 1;
}
/* On touch devices without hover, keep the overlay visible */
@media (hover: none) and (pointer: coarse) {
  .channel-logo-container .play-button { opacity: 1; }
}

.toast {
  position: fixed;
  top: 12px; right: 12px;
  background: #111827;
  color: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  opacity: 0.95;
  z-index: 1000;
}

/* Bulk action bar for multi-select */
.bulk-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.bulk-count { font-weight: 600; }

@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; }
  .sidebar { position: static; top: auto; }
}

.modal { position: fixed; inset: 0; z-index: 1000; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-dialog {
  position: relative;
  width: min(900px, 96vw);
  margin: 6vh auto 0;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.player-container { width: 100%; height: 0; padding-bottom: 56.25%; position: relative; overflow: hidden; border-radius: 8px; background: #000; }
.player-container > div, .player-container > iframe, .player-container > video { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; }
