/**
 * 365 Entertainment — Widget Base System
 * Shared styles for all embeddable widgets
 * Eagle modifies CSS variables — widget HTML/JS is locked
 *
 * Creator's color_scheme JSON maps to these variables:
 *   { "primary": "#e91e9c", "accent": "#ff69b4", "bg": "#000000" }
 */

/* ── CSS Variables (Eagle writes these) ──────────────────────── */
:root {
  /* Creator theme — Eagle overrides these per creator */
  --w-primary:    #a855f7;
  --w-accent:     #ec4899;
  --w-bg:         #0d1117;
  --w-surface:    #161b22;
  --w-border:     #30363d;
  --w-text:       #e6edf3;
  --w-text-muted: #7d8590;
  --w-success:    #22c55e;
  --w-danger:     #ef4444;
  --w-warning:    #f59e0b;

  /* Layout */
  --w-radius:     12px;
  --w-radius-sm:  8px;
  --w-radius-lg:  16px;
  --w-gap:        16px;
  --w-gap-sm:     8px;
  --w-gap-lg:     24px;

  /* Typography */
  --w-font:       'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --w-font-mono:  'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Widget Container ────────────────────────────────────────── */
.w-widget {
  font-family: var(--w-font);
  color: var(--w-text);
  background: var(--w-surface);
  border: 1px solid var(--w-border);
  border-radius: var(--w-radius);
  padding: var(--w-gap-lg);
  position: relative;
  overflow: hidden;
}

.w-widget-header {
  display: flex;
  align-items: center;
  gap: var(--w-gap-sm);
  margin-bottom: var(--w-gap);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--w-text-muted);
}

.w-widget-header .w-icon {
  color: var(--w-primary);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.w-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--w-radius-sm);
  font-family: var(--w-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1;
}

.w-btn-primary {
  background: var(--w-primary);
  color: #fff;
}
.w-btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.w-btn-accent {
  background: var(--w-accent);
  color: #fff;
}
.w-btn-accent:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.w-btn-outline {
  background: transparent;
  color: var(--w-primary);
  border: 1px solid var(--w-primary);
}
.w-btn-outline:hover {
  background: var(--w-primary);
  color: #fff;
}

.w-btn-ghost {
  background: transparent;
  color: var(--w-text-muted);
}
.w-btn-ghost:hover {
  color: var(--w-text);
  background: rgba(255,255,255,0.05);
}

.w-btn-sm { padding: 6px 12px; font-size: 12px; }
.w-btn-lg { padding: 14px 28px; font-size: 16px; }
.w-btn-block { width: 100%; }

.w-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ── Cards ───────────────────────────────────────────────────── */
.w-card {
  background: var(--w-surface);
  border: 1px solid var(--w-border);
  border-radius: var(--w-radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.w-card:hover {
  border-color: var(--w-primary);
  transform: translateY(-2px);
}

.w-card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.w-card-body {
  padding: var(--w-gap);
}

.w-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--w-text);
  margin-bottom: 4px;
}

.w-card-meta {
  font-size: 12px;
  color: var(--w-text-muted);
}

/* ── Badges ──────────────────────────────────────────────────── */
.w-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.w-badge-primary  { background: var(--w-primary); color: #fff; }
.w-badge-success  { background: var(--w-success); color: #fff; }
.w-badge-warning  { background: var(--w-warning); color: #000; }
.w-badge-danger   { background: var(--w-danger); color: #fff; }
.w-badge-owned    { background: var(--w-success); color: #fff; }

/* ── Price Tag ───────────────────────────────────────────────── */
.w-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--w-primary);
}
.w-price-old {
  font-size: 14px;
  color: var(--w-text-muted);
  text-decoration: line-through;
  margin-left: 8px;
}

/* ── Grid Layouts ────────────────────────────────────────────── */
.w-grid {
  display: grid;
  gap: var(--w-gap);
}
.w-grid-2 { grid-template-columns: repeat(2, 1fr); }
.w-grid-3 { grid-template-columns: repeat(3, 1fr); }
.w-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .w-grid-3, .w-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .w-grid-2, .w-grid-3, .w-grid-4 { grid-template-columns: 1fr; }
}

/* ── Loading Skeleton ────────────────────────────────────────── */
.w-skeleton {
  background: linear-gradient(90deg, var(--w-border) 25%, rgba(255,255,255,0.05) 50%, var(--w-border) 75%);
  background-size: 200% 100%;
  animation: w-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--w-radius-sm);
}

@keyframes w-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Toast / Notifications ───────────────────────────────────── */
.w-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--w-radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  z-index: 10000;
  animation: w-toast-in 0.3s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.w-toast-success { background: var(--w-success); }
.w-toast-error   { background: var(--w-danger); }
.w-toast-info    { background: var(--w-primary); }

@keyframes w-toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ── Form Inputs ─────────────────────────────────────────────── */
.w-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--w-bg);
  border: 1px solid var(--w-border);
  border-radius: var(--w-radius-sm);
  color: var(--w-text);
  font-family: var(--w-font);
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
  box-sizing: border-box;
}

.w-input:focus {
  border-color: var(--w-primary);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.w-input::placeholder {
  color: var(--w-text-muted);
}

.w-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--w-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
