/* Widget Base Styles */
.widget {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding: 16px;
  border-radius: 12px;
  min-width: 280px;
  max-width: 400px;
}

.widget-transparent {
  background: transparent !important;
}

/* === Dark Theme (default) === */
.widget-theme-dark {
  --widget-bg: rgba(18, 18, 18, 0.95);
  --widget-text: #ffffff;
  --widget-text-secondary: #a0a0a0;
  --widget-accent: #8b5cf6;
  --widget-highlight: rgba(139, 92, 246, 0.2);
  --widget-border: rgba(255, 255, 255, 0.1);
  --widget-success: #22c55e;
  --widget-danger: #ef4444;

  background: var(--widget-bg);
  color: var(--widget-text);
}

/* === Light Theme === */
.widget-theme-light {
  --widget-bg: rgba(255, 255, 255, 0.95);
  --widget-text: #1a1a1a;
  --widget-text-secondary: #666666;
  --widget-accent: #7c3aed;
  --widget-highlight: rgba(124, 58, 237, 0.1);
  --widget-border: rgba(0, 0, 0, 0.1);
  --widget-success: #16a34a;
  --widget-danger: #dc2626;

  background: var(--widget-bg);
  color: var(--widget-text);
}

/* === Neon Theme === */
.widget-theme-neon {
  --widget-bg: rgba(0, 0, 0, 0.9);
  --widget-text: #00ff88;
  --widget-text-secondary: #00cc6a;
  --widget-accent: #ff00ff;
  --widget-highlight: rgba(255, 0, 255, 0.2);
  --widget-border: #00ff88;
  --widget-success: #00ff88;
  --widget-danger: #ff0066;

  background: var(--widget-bg);
  color: var(--widget-text);
  border: 1px solid var(--widget-border);
  text-shadow: 0 0 10px currentColor;
}

/* === Common Elements === */
.widget-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--widget-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.widget-loading,
.widget-error {
  text-align: center;
  padding: 20px;
  color: var(--widget-text-secondary);
}

.widget-error {
  color: var(--widget-danger);
}

/* === Avatar === */
.widget-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.widget-avatar-lg {
  width: 48px;
  height: 48px;
}

.widget-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.widget-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--widget-accent);
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.widget-avatar-lg .widget-avatar-placeholder {
  font-size: 18px;
}

/* === Leaderboard Widget === */
.widget-leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.widget-leaderboard-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  transition: background 0.2s;
}

.widget-highlight {
  background: var(--widget-highlight) !important;
  border: 1px solid var(--widget-accent);
}

.widget-rank {
  font-weight: 700;
  font-size: 14px;
  min-width: 30px;
  color: var(--widget-text-secondary);
}

.widget-nickname {
  flex: 1;
  font-weight: 500;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-points {
  font-weight: 600;
  font-size: 14px;
  color: var(--widget-accent);
}

.widget-streak {
  font-size: 12px;
  color: var(--widget-text-secondary);
}

.widget-current-rank {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--widget-text-secondary);
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

/* === Current Assignment Widget === */
.widget-current {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.widget-no-assignment {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.widget-waiting {
  color: var(--widget-text-secondary);
  font-style: italic;
}

.widget-current-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.widget-game-cover {
  width: 60px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.widget-current-info {
  flex: 1;
  min-width: 0;
}

.widget-game-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.widget-assignment-type {
  font-size: 12px;
  color: var(--widget-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.widget-challenge {
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.widget-challenge-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.widget-challenge-desc {
  font-size: 12px;
  color: var(--widget-text-secondary);
  line-height: 1.4;
}

.widget-current-footer {
  display: flex;
  gap: 10px;
  align-items: center;
}

.widget-points-badge {
  background: var(--widget-accent);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.widget-difficulty {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 500;
}

.widget-difficulty-easy {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.widget-difficulty-medium {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
}

.widget-difficulty-hard {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.widget-bonus-progress {
  font-size: 12px;
  color: var(--widget-text-secondary);
  text-align: center;
  padding: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

/* === Progress Widget === */
.widget-progress {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.widget-progress-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.widget-progress-user {
  flex: 1;
  min-width: 0;
}

.widget-nickname-lg {
  font-size: 18px;
  font-weight: 700;
}

.widget-marathon-title {
  font-size: 12px;
  color: var(--widget-text-secondary);
}

.widget-progress-stats {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}

.widget-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  flex: 1;
}

.widget-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--widget-accent);
}

.widget-stat-label {
  font-size: 11px;
  color: var(--widget-text-secondary);
  text-transform: uppercase;
  margin-top: 4px;
}

.widget-progress-counts {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 14px;
}

.widget-completed {
  color: var(--widget-success);
  display: flex;
  align-items: center;
  gap: 4px;
}

.widget-dropped {
  color: var(--widget-danger);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* === Combined Widget === */
.widget-combined {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 320px;
  max-width: 420px;
}

.widget-combined-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--widget-border);
}

.widget-combined-user {
  flex: 1;
  min-width: 0;
}

.widget-combined-stats {
  display: flex;
  gap: 12px;
  margin-top: 2px;
}

.widget-combined-stat {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--widget-text-secondary);
}

.widget-streak-highlight {
  color: #f97316;
}

.widget-combined-current {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 10px;
}

.widget-combined-current-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--widget-text-secondary);
  margin-bottom: 4px;
}

.widget-combined-game {
  font-weight: 500;
}

.widget-combined-challenge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.widget-combined-points {
  font-size: 12px;
  color: var(--widget-accent);
  font-weight: 600;
}

.widget-combined-bonus {
  font-size: 11px;
  color: var(--widget-text-secondary);
  margin-top: 4px;
}

.widget-combined-leaderboard {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.widget-combined-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  font-size: 13px;
}

.widget-combined-row.widget-highlight {
  background: var(--widget-highlight);
}

.widget-combined-rank {
  font-size: 11px;
  color: var(--widget-text-secondary);
  min-width: 24px;
}

.widget-avatar-xs {
  width: 20px;
  height: 20px;
}

.widget-avatar-xs .widget-avatar-placeholder {
  font-size: 10px;
}

.widget-combined-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-combined-pts {
  font-size: 12px;
  color: var(--widget-accent);
  font-weight: 600;
}

.widget-combined-footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--widget-border);
  font-size: 12px;
}
