/* ========================================
   PIP (Picture-in-Picture) TWITCH PLAYER
   Floating Twitch stream player for non-home pages
   ======================================== */

.pip-player {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 320px;
  height: 180px;
  background: var(--color-bg-dark);
  border: 2px solid var(--color-primary);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 9999;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.pip-player:hover {
  box-shadow: 0 12px 48px rgba(74, 198, 255, 0.4);
}

/* Collapsed state */
.pip-player--collapsed {
  height: 48px;
  width: 200px;
}

.pip-player--collapsed .pip-player-content {
  display: none;
}

/* Header */
.pip-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.8);
  border-bottom: 1px solid var(--color-border, #2d2d31);
}

.pip-player-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pip-player-title::before {
  content: "⚫";
  color: #ef4444;
  font-size: 0.5rem;
  animation: pulse 2s ease-in-out infinite;
}

.pip-player-title.pip-player-title--offline::before {
  content: "⚫";
  color: #6b7280;
  animation: none;
}

.pip-player-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pip-player-button {
  background: none;
  border: none;
  color: var(--color-text-muted, #777);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition-fast);
}

.pip-player-button:hover {
  color: var(--color-primary);
}

.pip-player-button--close:hover {
  color: #ef4444;
}

/* Content */
.pip-player-content {
  width: 100%;
  height: calc(100% - 32px);
  background: #000;
}

.pip-player-content iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Offline placeholder */
.pip-player-offline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a1d 0%, #0e0e10 100%);
  color: var(--color-text-muted, #777);
  text-align: center;
  padding: var(--spacing-md);
}

.pip-player-offline-icon {
  font-size: 2rem;
  margin-bottom: var(--spacing-sm);
  opacity: 0.5;
}

.pip-player-offline-text {
  font-size: 0.75rem;
  font-weight: 600;
}

/* Responsive - Smaller on tablets and mobile */
@media (max-width: 1024px) {
  .pip-player {
    width: 240px;
    height: 135px;
    bottom: 16px;
    left: 16px;
  }

  .pip-player--collapsed {
    width: 180px;
    height: 40px;
  }
}

@media (max-width: 767px) {
  .pip-player {
    width: 180px;
    height: 101px;
    bottom: 12px;
    left: 12px;
    border-width: 1px;
  }

  .pip-player--collapsed {
    width: 120px;
    height: 32px;
  }

  .pip-player-header {
    padding: 6px 8px;
  }

  .pip-player-title {
    font-size: 0.625rem;
  }

  .pip-player-button {
    font-size: 0.875rem;
    padding: 2px;
  }

  .pip-player-content {
    height: calc(100% - 26px);
  }
}

/* Extra small screens - Very compact */
@media (max-width: 480px) {
  .pip-player {
    width: 160px;
    height: 90px;
  }

  .pip-player--collapsed {
    width: 100px;
    height: 28px;
  }
}

/* Draggable cursor (future enhancement) */
.pip-player--draggable {
  cursor: move;
}

.pip-player--draggable .pip-player-header {
  cursor: move;
}

/* Reopen Button (shown when PIP is closed) */
.pip-reopen-button {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #a970ff 100%);
  color: #fff;
  border: none;
  border-radius: 24px;
  font-family: var(--font-family-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(74, 198, 255, 0.3);
  transition: all var(--transition-normal);
  z-index: 9998;
  white-space: nowrap;
  overflow: hidden;
}

/* Holographic flash overlay for reopen button */
.pip-reopen-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  transition: left 0.6s ease;
  z-index: 1;
  pointer-events: none;
}

/* Trigger holographic flash on hover */
.pip-reopen-button:hover::before {
  left: 100%;
}

.pip-reopen-button:hover {
  background: linear-gradient(135deg, #a970ff 0%, #bf94ff 100%);
  box-shadow: 0 6px 24px rgba(74, 198, 255, 0.5);
  transform: translateY(-2px) scale(1.05);
}

.pip-reopen-button:active {
  transform: translateY(0) scale(1);
}

.pip-reopen-icon {
  font-size: 1rem;
  line-height: 1;
  position: relative;
  z-index: 2;
}

.pip-reopen-text {
  line-height: 1;
  position: relative;
  z-index: 2;
}

/* Responsive - Reopen button */
@media (max-width: 1024px) {
  .pip-reopen-button {
    bottom: 16px;
    left: 16px;
    padding: 10px 14px;
    font-size: 0.8125rem;
  }
}

@media (max-width: 767px) {
  .pip-reopen-button {
    bottom: 12px;
    left: 12px;
    padding: 8px 12px;
    font-size: 0.75rem;
    gap: 6px;
  }

  .pip-reopen-icon {
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  .pip-reopen-button {
    padding: 6px 10px;
    font-size: 0.6875rem;
  }

  .pip-reopen-text {
    display: none;
  }

  .pip-reopen-icon {
    font-size: 1rem;
  }
}
