* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #18181b;
  color: #efeff1;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(24, 24, 27, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  gap: 16px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #2e2e31;
  border-top-color: #9146FF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Login screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  text-align: center;
  background: #1f1f23;
  padding: 40px;
  border-radius: 8px;
  border: 1px solid #2e2e31;
}

.login-box h1 {
  font-size: 32px;
  margin-bottom: 12px;
  color: #9146FF;
}

.login-box p {
  font-size: 16px;
  color: #b3b3b3;
  margin-bottom: 24px;
}

.login-button {
  display: inline-block;
  background: #9146FF;
  color: white;
  padding: 12px 32px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  transition: background 0.2s;
}

.login-button:hover {
  background: #772ce8;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1f1f23;
  padding: 8px 12px;
  border-bottom: 1px solid #2e2e31;
  font-weight: 600;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Compact header for small docks */
@media (max-width: 400px) {
  header {
    padding: 4px 8px;
    gap: 4px;
  }
  
  .header-center {
    display: none; /* Hide category info in very small docks */
  }
  
  .header-right {
    display: none; /* Hide compact mode button in very small docks */
  }
  
  .toggle {
    font-size: 11px;
  }
  
  .toggle label {
    display: none; /* Hide "Same Category Only" text, keep just checkbox */
  }
  
  .icon-button {
    padding: 2px 6px;
    font-size: 12px;
  }
}

@media (max-width: 300px) {
  header {
    padding: 2px 6px;
    gap: 2px;
  }
  
  .header-left {
    gap: 4px;
  }
  
  .toggle input[type="checkbox"] {
    transform: scale(0.9);
  }
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-center {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: #a970ff;
  min-width: 150px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #b3b3b3;
  font-weight: normal;
}

.toggle input[type="checkbox"] {
  accent-color: #9146FF;
  cursor: pointer;
}

.icon-button {
  background: transparent;
  border: 1px solid #2e2e31;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.icon-button:hover:not(:disabled) {
  background: #2e2e31;
}

.icon-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Evil Streamers - Recently Raided */
.stream.evil {
  border-color: #ff4444 !important;
  border-width: 2px !important;
  background: linear-gradient(135deg, #1f1f23 0%, #2a1a1a 100%);
  position: relative;
}

.stream.favorited.evil {
  border-color: #ffaa44 !important; /* Orange for favorited evil streamers */
}

.stream.evil::before {
  content: "🔥";
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 12px;
  z-index: 5;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stream.evil .thumbnail {
  filter: sepia(0.3) hue-rotate(320deg) saturate(1.2);
}

.stream.evil .stream-name span {
  color: #ff6666;
}

.stream.evil .raid-button {
  background: #ff4444;
  color: white;
}

.stream.evil .raid-button:hover:not(:disabled) {
  background: #ff2222;
}

/* Streams Container - Responsive Grid with Scaling */
.streams-container {
  padding: 6px;
  display: grid;
  gap: 6px;
  
  /* Default: 1 column, but cards scale to fill width */
  grid-template-columns: 1fr;
}

/* 
  Responsive breakpoints with card scaling:
  - Below 600px: 1 column (cards scale up)
  - 600px-1100px: 2 columns (cards scale up)
  - 1100px-1600px: 3 columns (cards scale up)
  - Above 1600px: 4 columns (cards scale up)
*/
@media (min-width: 600px) {
  .streams-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .streams-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1600px) {
  .streams-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Responsive Thumbnail Scaling */
/* Ultra-wide: Full 16:9 thumbnails */
@media (min-width: 800px) {
  .thumbnail {
    aspect-ratio: 16/9;
  }
}

/* Wide: Slightly smaller 4:3 */
@media (max-width: 799px) {
  .thumbnail {
    aspect-ratio: 4/3;
  }
}

/* Medium: Square-ish */
@media (max-width: 600px) {
  .thumbnail {
    aspect-ratio: 1/1;
  }
}

/* Narrow: Small squares */
@media (max-width: 500px) {
  .thumbnail {
    aspect-ratio: 1/1;
    height: 80px;
  }
}

/* Very narrow: Tiny squares */
@media (max-width: 400px) {
  .thumbnail {
    aspect-ratio: 1/1;
    height: 60px;
  }
}

/* Ultra-narrow: Profile pic size */
@media (max-width: 300px) {
  .thumbnail {
    aspect-ratio: 1/1;
    height: 40px;
  }
}

/* Stream Card */
.stream {
  background: #1f1f23;
  border: 1px solid #2e2e31;
  border-radius: 6px;
  overflow: hidden;
  transition: background 0.2s, transform 0.2s;
  position: relative;
}

.stream:hover {
  background: #26262c;
  transform: translateY(-2px);
}

.stream.favorited {
  border-color: #ffd700;
}

.stream.raiding {
  border-color: #9146FF;
  border-width: 2px;
}

/* Thumbnail */
.thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-color: #0e0e10;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumbnail::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 70%, rgba(0, 0, 0, 0.5));
}

.thumbnail .live-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #eb0400;
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  z-index: 2;
}

/* Raid Status Overlay */
.raid-status-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
  padding: 16px;
}

.raid-status-text {
  font-size: 14px;
  font-weight: 600;
  color: #efeff1;
  text-align: center;
}

.raid-countdown {
  font-size: 24px;
  font-weight: 700;
  color: #9146FF;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #3a3a3d;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #9146FF, #772ce8);
  transition: width 0.5s linear;
  border-radius: 4px;
}

.raid-controls {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.raid-controls button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.raid-controls button:hover:not(:disabled) {
  transform: scale(1.05);
}

.raid-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-btn {
  background: #9146FF;
  color: white;
}

.send-btn:hover:not(:disabled) {
  background: #772ce8;
}

.abort-btn {
  background: #ff4b4b;
  color: white;
}

.abort-btn:hover {
  background: #e53935;
}

/* Stream Info */
.stream-info {
  padding: 8px 10px;
}

.stream-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.stream-name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.stream-name img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stream-name span {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.streamer-name-link {
  cursor: pointer;
  color: #efeff1;
  text-decoration: none;
  transition: color 0.2s;
}

.streamer-name-link:hover {
  color: #9146FF;
  text-decoration: underline;
}

.stream-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.action-icon {
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s;
  user-select: none;
}

.action-icon:hover {
  transform: scale(1.2);
}

.favorite-icon {
  color: #888;
}

.favorite-icon.active {
  color: #ffd700;
}

.block-icon {
  color: #888;
}

.block-icon.active {
  color: #ff5c5c;
}

.raid-button {
  background: #9146FF;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.raid-button:hover:not(:disabled) {
  background: #772ce8;
}

.raid-button:disabled {
  background: #4f4f4f;
  cursor: not-allowed;
  opacity: 0.6;
}

.stream-title {
  font-size: 12px;
  color: #b3b3b3;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-category {
  font-size: 12px;
  color: #a1a1a1;
  margin-bottom: 6px;
  font-style: italic;
}

.stream-stats {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: #b3b3b3;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Empty State */
.empty-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-icon,
.error-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state h2,
.error-state h2 {
  font-size: 20px;
  margin-bottom: 8px;
  color: #efeff1;
}

.empty-state p,
.error-state p {
  font-size: 14px;
  color: #b3b3b3;
  margin-bottom: 20px;
  max-width: 400px;
}

.refresh-button {
  background: #9146FF;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.refresh-button:hover {
  background: #772ce8;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1f1f23;
  border: 1px solid #2e2e31;
  border-radius: 6px;
  padding: 12px 16px;
  min-width: 250px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  border-left: 4px solid #00c853;
}

.toast.error {
  border-left: 4px solid #ff4b4b;
}

.toast.info {
  border-left: 4px solid #9146FF;
}

.toast-icon {
  font-size: 20px;
}

.toast-message {
  flex: 1;
  font-size: 13px;
}

/* Compact Mode */
body.compact-mode .stream {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 8px;
  margin-bottom: 4px;
}

body.compact-mode .thumbnail {
  display: none;
}

body.compact-mode .stream-info {
  padding: 0;
  width: 100%;
}

body.compact-mode .stream-header {
  margin-bottom: 2px;
}

body.compact-mode .stream-name img {
  width: 32px;
  height: 32px;
}

body.compact-mode .stream-title {
  display: none;
}

body.compact-mode .stream-category {
  font-size: 11px;
  margin-bottom: 2px;
}

body.compact-mode .stream-stats {
  font-size: 10px;
  gap: 8px;
}

body.compact-mode .streams-container {
  grid-template-columns: 1fr;
  gap: 2px;
}

body.compact-mode .raid-button {
  font-size: 10px;
  padding: 3px 10px;
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Tooltips */
.stream:hover .stream-title {
  white-space: normal;
  word-break: break-word;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #2e2e31;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a3a3d;
}

