/* ==========================================================================
   YouTube Studio Live WYSIWYG Editor Styles
   ========================================================================== */

/* Floating Studio Admin Toolbar */
#studioAdminBar {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(28, 28, 28, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 40px;
  padding: 6px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.2);
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f1f1f1;
  font-size: 13px;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  user-select: none;
}



.studio-bar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13.5px;
  color: #fff;
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.studio-bar-brand svg {
  color: #ff0000;
  flex-shrink: 0;
}

.studio-bar-section {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Channel Select */
.studio-select {
  background: #121212;
  color: #f1f1f1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.studio-select:hover, .studio-select:focus {
  border-color: #3ea6ff;
}

/* Action Buttons */
.studio-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #f1f1f1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.studio-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* Danger Button */
.studio-btn-danger {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 68, 68, 0.1);
}
.studio-btn-danger:hover {
  background: rgba(255, 68, 68, 0.22);
  color: #ff8585;
  border-color: rgba(255, 107, 107, 0.5);
}

/* Primary Save Button */
.studio-btn-save {
  background: #3ea6ff;
  color: #000;
  font-weight: 600;
  border: none;
  padding: 5px 14px;
}
.studio-btn-save:hover {
  background: #65b8ff;
  color: #000;
}
.studio-btn-save.dirty {
  background: #3ea6ff;
  box-shadow: 0 0 12px rgba(62, 166, 255, 0.6);
  animation: pulseSave 2s infinite ease-in-out;
}
@keyframes pulseSave {
  0%, 100% { box-shadow: 0 0 8px rgba(62, 166, 255, 0.5); }
  50% { box-shadow: 0 0 16px rgba(62, 166, 255, 0.9); }
}



/* Unsaved Dot */
.unsaved-dot {
  width: 7px;
  height: 7px;
  background: #ffab00;
  border-radius: 50%;
  display: none;
}
.studio-btn-save.dirty .unsaved-dot {
  display: inline-block;
}

/* ==========================================================================
   WYSIWYG Editable Element States (Active only in Edit Mode)
   ========================================================================== */
body.studio-edit-mode .studio-editable {
  transition: outline 0.15s ease, background 0.15s ease;
  position: relative;
  cursor: text !important;
}

body.studio-edit-mode .studio-editable:hover {
  outline: 1.5px dashed #3ea6ff !important;
  outline-offset: 3px !important;
  border-radius: 3px !important;
}

body.studio-edit-mode .studio-editable:focus,
body.studio-edit-mode .studio-editable[contenteditable="true"]:focus {
  outline: 2px solid #3ea6ff !important;
  outline-offset: 3px !important;
  background: rgba(62, 166, 255, 0.14) !important;
  border-radius: 3px !important;
}

/* Direct Image Editable State in Edit Mode (Zero wrapper, zero layout change) */
body.studio-edit-mode .studio-editable-img {
  cursor: pointer !important;
  transition: outline 0.15s ease, filter 0.15s ease !important;
}

body.studio-edit-mode .studio-editable-img:hover {
  outline: 2px dashed #3ea6ff !important;
  outline-offset: 2px !important;
  filter: brightness(0.88) !important;
}

/* Drawer Avatar specifically in Edit Mode - highlights ONLY the circle image */
body.studio-edit-mode #nav-drawer img.image-thumbnail {
  border-radius: 50% !important;
  cursor: pointer !important;
}

body.studio-edit-mode #nav-drawer img.image-thumbnail:hover {
  outline: 2px dashed #3ea6ff !important;
  outline-offset: 3px !important;
  border-radius: 50% !important;
  filter: brightness(0.88) !important;
}

body.studio-edit-mode #nav-drawer ytcp-overlay-with-link {
  pointer-events: none !important;
}

/* Chart Editable Badges */
body.studio-edit-mode .studio-chart-editable {
  cursor: pointer !important;
  position: relative !important;
  transition: box-shadow 0.2s ease, outline 0.2s ease;
}

body.studio-edit-mode .studio-chart-editable:hover {
  outline: 2px dashed rgba(62, 166, 255, 0.8) !important;
  outline-offset: 4px !important;
  border-radius: 8px !important;
}

.studio-chart-edit-banner {
  position: absolute;
  top: 8px;
  right: 12px;
  background: rgba(18, 18, 18, 0.92);
  border: 1px solid #3ea6ff;
  color: #3ea6ff;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  z-index: 20;
}
body.studio-edit-mode .studio-chart-editable:hover .studio-chart-edit-banner {
  display: inline-flex;
}

/* Shorts badge toggle indicator */
body.studio-edit-mode .studio-shorts-toggle {
  cursor: pointer !important;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
body.studio-edit-mode .studio-shorts-toggle:hover {
  transform: scale(1.15);
  filter: brightness(1.2);
}

/* ==========================================================================
   Slide-Out Data Drawers (28-Day Curve & 48-Hour Realtime)
   ========================================================================== */
.studio-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: 1000000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.studio-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.studio-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 90vw;
  background: #181818;
  border-left: 1px solid #333;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.7);
  z-index: 1000001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.1, 0.9, 0.2, 1);
  font-family: Roboto, -apple-system, sans-serif;
  color: #f1f1f1;
}
.studio-drawer.active {
  transform: translateX(0);
}

.studio-drawer-header {
  padding: 18px 20px;
  background: #202020;
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.studio-drawer-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.studio-drawer-close {
  background: transparent;
  border: none;
  color: #aaa;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.studio-drawer-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.studio-drawer-stats {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  background: #141414;
  border-bottom: 1px solid #292929;
}
.studio-drawer-stat-item {
  flex: 1;
}
.studio-drawer-stat-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 2px;
  font-weight: 500;
}
.studio-drawer-stat-val {
  font-size: 14px;
  font-weight: 600;
  color: #3ea6ff;
}

.studio-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
}

.studio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.studio-table th {
  text-align: left;
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  padding: 8px 10px;
  border-bottom: 1px solid #2a2a2a;
  position: sticky;
  top: 0;
  background: #181818;
  z-index: 2;
}
.studio-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #222;
}
.studio-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.studio-table-input {
  width: 100%;
  background: #0d0d0d;
  color: #fff;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}
.studio-table-input:focus {
  border-color: #3ea6ff;
  background: #111;
}

.studio-drawer-footer {
  padding: 14px 20px;
  background: #202020;
  border-top: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Toast Notifications */
#studioToast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #121212;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13.5px;
  font-family: Roboto, sans-serif;
  z-index: 1000005;
  transition: transform 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
#studioToast.show {
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Preview Mode: Completely hide toolbar & all editor overlays for 100% authentic UI
   ========================================================================== */
body:not(.studio-edit-mode) #studioAdminBar {
  display: none !important;
}

body:not(.studio-edit-mode) .studio-drawer,
body:not(.studio-edit-mode) .studio-drawer-backdrop,
body:not(.studio-edit-mode) .studio-chart-edit-banner {
  display: none !important;
}

/* Subtle top-edge hover pill to switch back from Preview to Edit mode */
#studioPreviewSwitchPill {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: rgba(24, 24, 24, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-top: none;
  border-radius: 0 0 16px 16px;
  padding: 5px 14px 6px;
  color: #3ea6ff;
  font-family: Roboto, -apple-system, sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  z-index: 9999999;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  user-select: none;
}

#studioPreviewSwitchPill.reveal,
#studioPreviewSwitchPill:hover {
  transform: translateX(-50%) translateY(0);
}

body.studio-edit-mode #studioPreviewSwitchPill {
  display: none !important;
}

/* ==========================================================================
   Top Content in this Period: Row Actions & Add/Delete Buttons
   ========================================================================== */
.studio-top-content-del-btn {
  display: none;
  background: rgba(255, 68, 68, 0.12);
  color: #ff5555;
  border: 1px solid rgba(255, 68, 68, 0.35);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 12px;
  flex-shrink: 0;
  transition: all 0.18s ease;
  padding: 0;
}

.studio-top-content-del-btn:hover {
  background: #ff4444;
  color: #fff;
  border-color: #ff4444;
  transform: scale(1.15);
}

body.studio-edit-mode .tappable.row:hover .studio-top-content-del-btn {
  display: inline-flex;
}

/* Top Content Add Video Button */
.studio-top-content-actions {
  display: none;
  padding: 10px 18px 14px;
}

body.studio-edit-mode .studio-top-content-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.studio-top-content-add-btn {
  background: rgba(62, 166, 255, 0.08);
  color: #3ea6ff;
  border: 1px dashed rgba(62, 166, 255, 0.4);
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.studio-top-content-add-btn:hover {
  background: rgba(62, 166, 255, 0.18);
  border-color: #3ea6ff;
  border-style: solid;
}

/* Ensure completely invisible in preview mode */
body:not(.studio-edit-mode) .studio-top-content-actions,
body:not(.studio-edit-mode) .studio-top-content-del-btn {
  display: none !important;
}

/* ==========================================================================
   Universal Perfect Image Fitting (object-fit: cover)
   Ensures all uploaded custom thumbnails and avatars fit their containers
   perfectly without stretching, squishing, or distortion.
   ========================================================================== */

/* 1. Video Thumbnails in "Your top content in this period" */
yta-top-performing-entities img.style-scope.yta-top-performing-entities,
yta-top-performing-entities .entity img,
yta-top-performing-entities img {
  object-fit: cover !important;
  object-position: center !important;
}

/* 2. Video Thumbnails in Realtime 48-Hour Card */
yta-latest-activity-card img#img-with-fallback,
yta-latest-activity-card ytcp-img-with-fallback img,
ytcp-img-with-fallback img,
.entity-container ytcp-img-with-fallback img {
  object-fit: cover !important;
  object-position: center !important;
}

/* 3. Video Thumbnail in "Latest content" Snapshot Carousel */
yta-entity-snapshot-carousel img[test-id="thumbnail"],
yta-entity-snapshot-carousel img.thumbnail,
ytcp-thumbnail-with-title img.thumbnail,
yta-entity-snapshot-carousel img {
  object-fit: cover !important;
  object-position: center !important;
}

/* 4. Channel Avatars (Drawer Navigation & Topbar Header) */
#nav-drawer img.image-thumbnail,
#nav-drawer img.thumbnail,
ytd-topbar-menu-button-renderer img#img,
ytcp-topbar-menu-button-renderer img#img,
#avatar-btn img,
yt-img-shadow img#img {
  object-fit: cover !important;
  object-position: center !important;
}



