/* ============================================================================
   Canva-Style Editor Toolbar
   ============================================================================ */

.canva-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 12px;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  position: relative;
  z-index: 200; /* Above sidebar (z-index: 50) so dropdown menus work */
}

.canva-toolbar-left,
.canva-toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.canva-toolbar-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.canva-toolbar-title {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid transparent;
  cursor: text;
  transition: all 0.15s ease;
  max-width: 300px;
  min-width: 100px;
  text-align: center;
}

.canva-toolbar-title:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.canva-toolbar-title:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 168, 255, 0.5);
  color: #fff;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.canva-toolbar-title:empty::before {
  content: 'Untitled Collection';
  color: rgba(255, 255, 255, 0.4);
}

.canva-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm, 4px);
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.canva-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

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

.canva-toolbar-btn:disabled:hover {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
}

.canva-toolbar-btn svg {
  flex-shrink: 0;
}

.canva-toolbar-btn-primary {
  background: rgba(0, 168, 255, 0.15);
  border: 1px solid rgba(0, 168, 255, 0.3);
  color: #00a8ff;
}

.canva-toolbar-btn-primary:hover {
  background: rgba(0, 168, 255, 0.25);
  color: #00a8ff;
}

.canva-toolbar-separator {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 8px;
}

/* Dropdown Menu */
.canva-toolbar-dropdown {
  position: relative;
  z-index: 100;
}

.canva-toolbar-dropdown-trigger .dropdown-arrow {
  transition: transform 0.15s ease;
}

.canva-toolbar-dropdown.open .canva-toolbar-dropdown-trigger {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.canva-toolbar-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.canva-toolbar-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 200px;
  background: var(--color-bg-base-darker, #4a4c54);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  padding: 6px;
  z-index: 1000;
}

.canva-toolbar-dropdown.open .canva-toolbar-dropdown-menu {
  display: block;
}

.canva-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm, 4px);
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
}

.canva-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.canva-dropdown-item svg {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.6);
}

.canva-dropdown-item .shortcut {
  margin-left: auto;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}

.canva-dropdown-item-danger {
  color: #f87171;
}

.canva-dropdown-item-danger:hover {
  background: rgba(248, 113, 113, 0.15);
}

.canva-dropdown-item-danger svg {
  color: #f87171;
}

.canva-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 6px 0;
}

/* ============================================================================
   Canva-Style Sidebar
   ============================================================================ */

.canva-sidebar {
  display: flex;
  flex-direction: row;
  height: calc(100vh - 100px); /* 60px nav + 40px toolbar */
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

/* Icon Rail - thin strip always visible */
.canva-sidebar-rail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 56px;
  background: transparent;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 0;
  gap: 0;
  z-index: 51;
  flex-shrink: 0;
}

.canva-rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.canva-rail-btn:hover,
.canva-rail-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.canva-rail-btn.active {
  background: rgba(0, 168, 255, 0.15);
  color: #00a8ff;
}

.canva-rail-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.rail-btn-label {
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Expandable Panel Container */
.canva-sidebar-panel {
  width: 0;
  overflow: hidden;
  background: transparent;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: width 0.2s ease;
  flex-shrink: 0;
}

.canva-sidebar-panel.expanded {
  width: 380px;
}

/* Individual Panels */
.canva-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 380px;
}

.canva-panel.active {
  display: flex;
}

.canva-panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  background: transparent;
}

.canva-panel-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.canva-panel-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Panel Search Input */
.panel-search-input {
  width: calc(100% - 24px);
  margin: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  transition: border-color 0.2s;
}

.panel-search-input:focus {
  outline: none;
  border-color: rgba(0, 168, 255, 0.5);
}

.panel-search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* Text Panel Buttons */
.text-block-btn {
  display: flex;
  align-items: center;
  width: calc(100% - 24px);
  margin: 0 12px 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.text-block-btn:first-child {
  margin-top: 12px;
}

.text-block-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.text-preview {
  flex: 1;
}

.text-preview-h1 {
  font-size: 18px;
  font-weight: 700;
}

.text-preview-h2 {
  font-size: 14px;
  font-weight: 600;
}

.text-preview-body {
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
}

.text-block-btn svg {
  width: 18px;
  height: 18px;
  margin-right: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.panel-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 12px;
}

/* Panel Loading/Error States */
.panel-loading,
.panel-error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

.panel-error {
  color: rgba(255, 100, 100, 0.8);
}

/* Topics/Creators List Items */
.topic-item,
.creator-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.topic-item:hover,
.creator-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.topic-item-icon,
.creator-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(0, 168, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(0, 168, 255, 0.8);
}

.creator-item-avatar {
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.creator-item-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.topic-item-name,
.creator-item-name {
  font-size: 13px;
  color: #fff;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-item-count,
.creator-item-posts {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

/* ============================================================================
   Content Panel - Existing Sidebar Styles Override
   ============================================================================ */

/* Reset the timeline-post-sidebar styles when inside canva panel */
.canva-panel .sidebar-tabs {
  display: flex;
  padding: 0 12px;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.canva-panel .sidebar-tab {
  flex: 1;
  padding: 12px 8px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease;
}

.canva-panel .sidebar-tab:hover {
  color: rgba(255, 255, 255, 0.9);
}

.canva-panel .sidebar-tab.active {
  color: #00a8ff;
}

.canva-panel .sidebar-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 2px;
  background: #00a8ff;
  border-radius: 2px 2px 0 0;
}

.canva-panel .sidebar-filter-bar {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.canva-panel .sidebar-post-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.canva-panel .sidebar-post-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 13px;
}

.canva-panel .sidebar-post-search-input:focus {
  outline: none;
}

.canva-panel .sidebar-post-search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.canva-panel .sidebar-post-search svg {
  color: rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.canva-panel .sidebar-active-filters {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
}

.canva-panel .sidebar-active-filters[style*="display: flex"] {
  display: flex !important;
}

.canva-panel .sidebar-post-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.canva-panel .sidebar-hidden {
  display: none !important;
}

/* Post items in canva panel - vertical layout */
.canva-panel .sidebar-post-item {
  display: flex;
  flex-direction: row;
  gap: 8px;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.canva-panel .sidebar-post-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.canva-panel .sidebar-post-item-thumb {
  width: 60px;
  height: 48px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canva-panel .sidebar-post-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.canva-panel .sidebar-post-item-thumb svg {
  color: rgba(255, 255, 255, 0.3);
}

.canva-panel .sidebar-post-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.canva-panel .sidebar-post-item-title {
  font-size: 12px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canva-panel .sidebar-post-item-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
}

/* Content preview items in canva panel */
.canva-panel .sidebar-post-item.sidebar-post-item-content {
  position: relative;
  height: 120px;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
}

.canva-panel .sidebar-post-item.sidebar-post-item-content[data-platform="instagram"] {
  height: 180px;
}

.canva-panel .sidebar-post-content-embed {
  position: absolute;
  inset: 0;
}

/* Discovery bar in canva panel - remove the glow/border from timeline-editor.css */
.canva-panel .sidebar-discovery-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.canva-panel .discovery-links-wrapper {
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.canva-panel .discovery-links-wrapper::-webkit-scrollbar {
  display: none;
}

.canva-panel .discovery-links {
  display: flex;
  gap: 6px;
}

.canva-panel .discovery-link {
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm, 4px);
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: none;
}

.canva-panel .discovery-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: none;
}

.canva-panel .discovery-link.active {
  background: rgba(0, 168, 255, 0.15);
  border-color: rgba(0, 168, 255, 0.3);
  color: #00a8ff;
  box-shadow: none;
}

.canva-panel .discovery-search-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  flex-shrink: 0;
}

.canva-panel .discovery-search-input {
  width: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 11px;
  transition: width 0.2s ease;
}

.canva-panel .discovery-search-pill.expanded .discovery-search-input {
  width: 100px;
}

.canva-panel .discovery-search-input:focus {
  outline: none;
}

.canva-panel .discovery-search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* Active filters pills */
.canva-panel .sidebar-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(0, 168, 255, 0.15);
  border: 1px solid rgba(0, 168, 255, 0.3);
  border-radius: var(--radius-sm, 4px);
  font-size: 11px;
  color: #00a8ff;
}

.canva-panel .sidebar-filter-pill-remove {
  background: transparent;
  border: none;
  color: rgba(0, 168, 255, 0.6);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.canva-panel .sidebar-filter-pill-remove:hover {
  color: #00a8ff;
}

.canva-panel .sidebar-clear-filters-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  cursor: pointer;
}

.canva-panel .sidebar-clear-filters-btn:hover {
  color: #fff;
}

/* Loading states in canva panel */
.canva-panel .sidebar-loading,
.canva-panel .sidebar-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

.canva-panel .sidebar-login-message {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 768px) {
  .canva-editor-toolbar {
    padding: 0 8px;
  }

  .canva-toolbar-title {
    font-size: 12px;
  }

  .canva-toolbar-btn span {
    display: none;
  }

  .canva-toolbar-btn {
    padding: 6px 8px;
  }

  .canva-sidebar {
    position: fixed;
    left: 0;
    top: 100px;
    bottom: 0;
    z-index: 100;
  }

  .canva-sidebar-panel.expanded {
    width: 280px;
  }

  .canva-panel {
    width: 280px;
  }
}

@media (max-width: 480px) {
  .canva-toolbar-center {
    display: none;
  }

  .canva-sidebar-rail {
    width: 48px;
  }

  .rail-btn-label {
    display: none;
  }

  .canva-sidebar-panel.expanded {
    width: calc(100vw - 48px);
  }

  .canva-panel {
    width: calc(100vw - 48px);
  }
}
