/* ============================================
   COLLAB SYSTEM STYLES
   ============================================ */

/* Notification Bell */
.collab-notification-bell {
  position: relative;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.collab-notification-bell:hover {
  background: rgba(0, 0, 0, 0.05);
}

.collab-notification-bell.has-notifications {
  animation: bell-ring 0.5s ease;
}

.notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #ff4444;
  color: white;
  font-size: 11px;
  font-weight: 600;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

@keyframes bell-ring {
  0%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(-10deg); }
  20%, 40% { transform: rotate(10deg); }
  50% { transform: rotate(0deg); }
}

/* Invitations Modal */
#collab-invitations-modal {
  z-index: 1000;
}

.collab-invitations-content {
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.invitations-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.collab-invitation-card {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s ease;
}

.collab-invitation-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #6366f1;
}

.invitation-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.invitation-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.invitation-info h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.invitation-info .username {
  font-size: 13px;
  color: #666;
}

.invitation-message {
  margin: 8px 0;
  font-size: 14px;
  color: #444;
  font-style: italic;
  padding: 8px 12px;
  background: rgba(99, 102, 241, 0.05);
  border-left: 3px solid #6366f1;
  border-radius: 4px;
}

.invitation-stream-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 6px;
  font-size: 13px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ff4444;
  font-weight: 600;
}

.stream-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invitation-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.invitation-actions .btn-primary,
.invitation-actions .btn-secondary {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
}

.empty-state {
  text-align: center;
  color: #999;
  padding: 40px 20px;
  font-size: 14px;
}

/* Invite to Collab Modal */
#invite-to-collab-modal {
  z-index: 1000;
}

.invite-collab-modal-content {
  max-width: 500px;
}

.search-container {
  position: relative;
}

.search-container .search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e0e0e0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 10;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #f5f5f5;
}

.result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.result-info h5 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.result-info span {
  font-size: 12px;
  color: #666;
}

.selected-creator {
  margin: 16px 0;
  padding: 12px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.creator-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.creator-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.creator-info h4 {
  margin: 0;
  font-size: 14px;
}

.creator-info span {
  font-size: 12px;
  color: #666;
  display: block;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  margin-left: auto;
  color: #666;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  color: #333;
}

/* Active Collab Bar */
#active-collab-bar {
  display: none;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  margin: 12px 0;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.collab-bar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.collab-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.collab-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.collab-with {
  font-size: 14px;
  white-space: nowrap;
}

.collab-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.btn-danger {
  background: rgba(255, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: rgba(255, 68, 68, 1);
  transform: translateY(-1px);
}

/* Collab History Modal */
#creator-collab-history-modal {
  z-index: 1000;
}

.collab-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.collab-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.collab-history-item:hover {
  background: #f9f9f9;
  border-color: #6366f1;
}

.history-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.history-info h5 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
}

.history-date,
.history-duration {
  display: block;
  font-size: 12px;
  color: #666;
}

.history-duration::before {
  content: ' \2022 ';
}

/* Modal Actions */
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: flex-end;
}

.modal-actions .btn-secondary,
.modal-actions .btn-primary {
  flex: 0 1 auto;
  min-width: 100px;
}

/* Loading State */
.loading {
  text-align: center;
  color: #999;
  padding: 40px 20px;
}

/* Profile Button */
.collab-profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #6366f1;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.collab-profile-btn:hover {
  background: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Responsive */
/* ============================================
   COLLAB DISCOVERY & STATS
   ============================================ */

.active-collabs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.active-collab-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.active-collab-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border-color: #6366f1;
  transform: translateY(-2px);
}

.collab-badge {
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: white;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.collab-creators {
  display: flex;
  align-items: center;
  padding: 16px;
  gap: 12px;
}

.creator-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.creator-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.creator-info h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.followers {
  font-size: 11px;
  color: #666;
  display: block;
}

.collab-divider {
  color: #ddd;
  font-weight: 300;
  font-size: 18px;
}

.collab-stream-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f9f9f9;
  border-top: 1px solid #e0e0e0;
  font-size: 12px;
  flex-wrap: wrap;
}

.live-indicator {
  color: #ff4444;
  font-weight: 600;
}

.stream-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-count {
  color: #666;
  white-space: nowrap;
}

.collab-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
  font-size: 12px;
  color: #666;
}

.collab-time {
  color: #999;
}

/* Collab Stats */
.collab-stats {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
}

.collab-stats h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-item {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #6366f1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  color: #666;
  font-weight: 500;
  text-transform: uppercase;
}

.top-collaborators {
  margin-top: 20px;
}

.top-collaborators h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
}

.collaborators-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.collaborator-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  background: #f9f9f9;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.collaborator-item:hover {
  background: #f0f0f0;
}

.collab-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.collab-info h5 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.collab-info span {
  font-size: 11px;
  color: #666;
  display: block;
}

/* Collab History */
.collab-history-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
}

.collab-history-section h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.history-card:hover {
  border-color: #6366f1;
  background: #f9f9f9;
}

.history-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.history-info h5 {
  margin: 0 0 2px 0;
  font-size: 13px;
  font-weight: 600;
}

.history-date,
.history-duration {
  font-size: 11px;
  color: #666;
}

.history-duration::before {
  content: ' \2022 ';
}

/* Collab Dashboard */
.collab-dashboard {
  padding: 20px 0;
}

.dashboard-header {
  margin-bottom: 24px;
}

.dashboard-header h2 {
  margin: 0 0 4px 0;
  font-size: 24px;
}

.dashboard-header .subtitle {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.dashboard-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.2s ease;
}

.dashboard-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: #6366f1;
}

.dashboard-card.featured {
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: white;
  border: none;
}

.dashboard-card.featured:hover {
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.card-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.card-content {
  flex: 1;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  color: #6366f1;
  margin-bottom: 4px;
}

.dashboard-card.featured .card-value {
  color: white;
}

.card-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 8px;
}

.dashboard-card.featured .card-label {
  color: rgba(255, 255, 255, 0.8);
}

.card-description {
  margin: 0;
  font-size: 12px;
  color: #888;
  line-height: 1.4;
}

.dashboard-card.featured .card-description {
  color: rgba(255, 255, 255, 0.9);
}

.dashboard-card.featured h4 {
  margin: 4px 0;
  font-size: 16px;
  color: white;
}

/* Collaborators Section */
.collaborators-section {
  margin-top: 32px;
}

.collaborators-section h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
}

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

.collab-badge-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  transition: all 0.2s ease;
  animation: slideIn 0.3s ease forwards;
  opacity: 0;
}

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

.collab-badge-card:hover {
  border-color: #6366f1;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.collab-badge-card img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 8px;
}

.badge-info h5 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-info span {
  font-size: 11px;
  color: #666;
  display: block;
}

.btn-icon-small {
  background: #6366f1;
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  transition: all 0.2s ease;
}

.btn-icon-small:hover {
  background: #4f46e5;
  transform: scale(1.1);
}

/* ============================================
   LIVE COLLAB STREAMING STYLES
   ============================================ */

#collab-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

/* Split Screen Layout */
.collab-split-screen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr auto;
  gap: 4px;
  height: 100%;
  width: 100%;
  background: #000;
  overflow: hidden;
}

.collab-split-screen.vertical {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr auto;
}

.collab-stream {
  position: relative;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #222;
}

.collab-stream video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stream-label {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  z-index: 10;
  text-transform: uppercase;
}

.audio-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 20px;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 8px;
  border-radius: 4px;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.audio-indicator.muted {
  opacity: 0.3;
}

/* Split Screen Controls */
.collab-controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.8);
  border-top: 1px solid #222;
}

.collab-btn {
  background: rgba(99, 102, 241, 0.9);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.collab-btn:hover {
  background: rgba(99, 102, 241, 1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.collab-btn.muted {
  background: rgba(255, 68, 68, 0.7);
}

.collab-btn.danger {
  background: rgba(255, 68, 68, 0.9);
}

.collab-btn.danger:hover {
  background: rgba(255, 68, 68, 1);
}

/* Picture-in-Picture Layout */
.collab-pip {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.pip-main {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pip-guest {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 200px;
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 2px solid #6366f1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
}

.pip-guest:hover {
  width: 240px;
  height: 180px;
}

.pip-guest video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pip-controls {
  position: absolute;
  bottom: 180px;
  right: 20px;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  border: 1px solid #333;
  padding: 8px;
  gap: 8px;
  width: 200px;
}

.pip-controls .collab-btn {
  width: 100%;
  text-align: center;
  padding: 6px 12px;
  font-size: 12px;
}

/* Collab Chat Panel */
#collab-chat-panel {
  position: absolute;
  right: 0;
  top: 0;
  width: 300px;
  height: 100%;
  background: white;
  border-left: 1px solid #e0e0e0;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#collab-chat-panel.visible {
  transform: translateX(0);
}

.collab-chat-header {
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
  font-weight: 600;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.collab-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.collab-chat-message {
  background: #f5f5f5;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
}

.collab-chat-message.own {
  background: rgba(99, 102, 241, 0.1);
  align-self: flex-end;
  max-width: 80%;
}

.collab-chat-input {
  padding: 12px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 8px;
}

.collab-chat-input input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
}

.collab-chat-input button {
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .collab-split-screen {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr auto;
  }

  .pip-guest {
    width: 120px;
    height: 90px;
    bottom: 60px;
    right: 12px;
  }

  .pip-guest:hover {
    width: 140px;
    height: 105px;
  }

  .pip-controls {
    width: 120px;
    bottom: 100px;
    right: 12px;
  }

  #collab-chat-panel {
    width: 100%;
    position: fixed;
    bottom: 0;
    right: 0;
    height: 40%;
    transform: translateY(100%);
  }

  #collab-chat-panel.visible {
    transform: translateY(0);
  }

  .collab-controls {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
  }

  .collab-btn {
    padding: 6px 12px;
    font-size: 12px;
    flex: 0 1 calc(33.333% - 6px);
  }
}

@media (max-width: 640px) {
  .collab-invitations-content,
  .invite-collab-modal-content {
    max-width: 90%;
  }

  .collab-bar-content {
    flex-direction: column;
    gap: 12px;
  }

  .collab-indicator {
    flex-direction: column;
  }

  .collab-with {
    display: none;
  }

  .invitation-actions {
    flex-direction: column;
  }

  .invitation-actions button {
    width: 100%;
  }

  .search-container .search-results {
    max-height: 200px;
  }

  .pip-guest {
    width: 100px;
    height: 75px;
  }

  .pip-controls {
    width: 100px;
  }

  .stream-label {
    font-size: 10px;
    padding: 2px 8px;
  }
}

/* ============================================
   BUG FIX: Explore page gap between filter tabs and feed
   The .main-content flex child stretches to sidebar height
   (align-items: stretch default). CSS Grid's default
   align-content: stretch then expands grid tracks,
   creating a large empty gap. Fix: pack tracks to start.
   ============================================ */
.explore-discovery-layout {
  align-content: start;
}
