/* ============================================================
   SHAWNLOGIC — "SUNLIT STUDIO" THEME
   A bright, warm, colorful makeover.
   All JS logic is UNTOUCHED. Every selector is preserved so the
   drag/resize/taskbar/drawing logic keeps working — only the
   visual design values changed.
   ============================================================ */
/* Fonts load via <link> in index.html — no @import (avoids duplicate fetch). */

/* ============ GLOBAL ============ */
* { box-sizing: border-box; }

:root {
  /* Soft, warm, colorful base */
  --bg: #f2ecff;
  --bg-darker: #eadcf9;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-hover: rgba(255, 255, 255, 0.96);
  --border: rgba(90, 70, 140, 0.12);
  --border-hover: rgba(124, 92, 255, 0.45);
  --text: #2b2440;
  --text-secondary: #6f6688;
  --muted: #9a90b4;
  /* Brand accents */
  --accent: #7c5cff;          /* violet */
  --accent-hover: #6a46ff;
  --accent-muted: rgba(124, 92, 255, 0.10);
  --accent-glow: rgba(124, 92, 255, 0.28);
  /* Feature accent colors */
  --neon-pink: #ff5f8f;       /* drawing / warm */
  --neon-purple: #a78bfa;
  --neon-green: #2fd6a6;      /* mint */
  --neon-lime: #6ee7a0;
  --warm: #ffb454;            /* amber - notes */
  --sky: #4ea1ff;             /* video */
  /* Shapes */
  --radius: 20px;
  --radius-sm: 12px;
  --font-body: 'Inter', 'Segoe UI', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: 'Orbitron', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', ui-monospace, monospace;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(120% 90% at 10% 0%, rgba(255, 182, 198, 0.45), transparent 55%),
    radial-gradient(120% 90% at 90% 10%, rgba(167, 139, 250, 0.40), transparent 55%),
    radial-gradient(120% 100% at 50% 100%, rgba(126, 231, 160, 0.35), transparent 55%),
    linear-gradient(160deg, #f6f0ff 0%, #fdeef6 45%, #eef7ff 100%);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Soft dotted texture instead of scanlines — playful, brighter */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99999;
  background-image: radial-gradient(rgba(124, 92, 255, 0.10) 1px, transparent 1.2px);
  background-size: 22px 22px;
  opacity: 0.25;
}

/* ============ DOCK / HEADER ============ */
.dock {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(90, 70, 140, 0.10);
  box-shadow: 0 4px 24px rgba(124, 92, 255, 0.08);
}
.dock-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 2px;
  color: var(--text);
  background: linear-gradient(120deg, #7c5cff 0%, #ff5f8f 50%, #ffb454 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.dock-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}
.dock-buttons button,
.dock-link {
  background: #ffffff;
  border: 1px solid rgba(124, 92, 255, 0.18);
  color: var(--text-secondary);
  border-radius: 14px;
  padding: 9px 18px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-decoration: none;
  transition: all 0.2s ease, transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(90, 70, 140, 0.08);
}
.dock-buttons button:hover,
.dock-link:hover {
  background: #fff;
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 6px 18px rgba(124, 92, 255, 0.18);
  transform: translateY(-2px);
}
.dock-buttons button:active,
.dock-link:active {
  transform: scale(0.95);
}
.dock-buttons button:focus-visible,
.dock-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.dock-buttons button.active {
  background: linear-gradient(120deg, rgba(124, 92, 255, 0.14), rgba(255, 95, 143, 0.12));
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ============ DASHBOARD ============ */
.dashboard {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 88px;
  min-height: calc(100vh - 70px);
  position: relative;
}

/* ============ WIDGETS ============ */
.widget {
  background: var(--surface);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow:
    0 8px 30px rgba(95, 75, 150, 0.12),
    0 2px 8px rgba(95, 75, 150, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s ease,
              box-shadow 0.25s ease,
              border-color 0.25s ease;
  animation: widget-enter 0.5s ease both;
  position: relative;
}
.widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--neon-pink), var(--warm), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}
.widget:hover::before {
  opacity: 1;
}
.widget:hover {
  transform: translateY(-4px);
  box-shadow:
    0 16px 40px rgba(95, 75, 150, 0.16),
    0 4px 12px rgba(95, 75, 150, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 1);
}

.widget.dragged {
  position: absolute;
  margin: 0;
  z-index: 1000;
}
.widget.dragged:hover {
  transform: none;
}

.widget.maximized {
  border-radius: 14px !important;
  border: 1px solid rgba(124, 92, 255, 0.25) !important;
  box-shadow: 0 24px 60px rgba(60, 40, 120, 0.22) !important;
  animation: none !important;
  transform: none !important;
  overflow-y: auto;
}
.widget:nth-child(1) { animation-delay: 0.05s; }
.widget:nth-child(2) { animation-delay: 0.15s; }
.widget:nth-child(3) { animation-delay: 0.25s; }

@keyframes widget-enter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.widget-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(90, 70, 140, 0.08);
  background: rgba(255, 255, 255, 0.5);
  user-select: none;
}

.win-controls {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.win-btn {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(124, 92, 255, 0.10);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
}
.win-btn:hover { background: var(--accent); color: #fff; box-shadow: 0 4px 12px var(--accent-glow); }
.win-close:hover { background: var(--neon-pink); box-shadow: 0 4px 12px rgba(255, 95, 143, 0.35); }
.win-min:hover  { background: var(--warm); box-shadow: 0 4px 12px rgba(255, 180, 84, 0.35); }

.widget-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
  border-radius: 50%;
  margin-left: auto;
  transition: color 0.15s ease, background 0.15s ease;
}
.widget-close:hover {
  color: var(--neon-pink);
  background: rgba(255, 95, 143, 0.12);
}
.widget-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--text);
  text-transform: uppercase;
}
.widget-hint {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.widget-body {
  flex: 1;
  min-height: 0;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
}
.widget-body > * {
  width: 100%;
}

/* ============ VIDEO (sky accent) ============ */
#widget-video .widget-bar { background: linear-gradient(120deg, rgba(78, 161, 255, 0.18), rgba(78, 161, 255, 0.05)); }
#widget-video .widget-title { color: #2f7fe0; }

#video-container {
  flex: 1;
  min-height: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #cfe6ff;
  border: 1px solid rgba(78, 161, 255, 0.25);
}
#video-container iframe,
#video-container > div {
  width: 100% !important;
  height: 100% !important;
  border: 0;
}
.video-controls {
  display: flex;
  gap: 10px;
  padding-top: 12px;
}
.video-controls button {
  flex: 1;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s ease, transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(78, 161, 255, 0.12);
}
.video-controls button:hover {
  background: #fff;
  border-color: var(--sky);
  color: var(--sky);
  box-shadow: 0 6px 16px rgba(78, 161, 255, 0.22);
  transform: translateY(-2px);
}
.video-controls button:active {
  transform: scale(0.97);
}
.video-controls button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(78, 161, 255, 0.35);
}
.video-controls button:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}
.video-controls #start-call {
  background: linear-gradient(120deg, var(--sky), #6d9dff);
  border-color: transparent;
  color: #fff;
}
.video-controls #start-call:hover {
  background: linear-gradient(120deg, #3d94ff, #5a8dff);
  color: #fff;
  box-shadow: 0 8px 20px rgba(78, 161, 255, 0.35);
}
.video-controls #leave-call {
  border-color: rgba(255, 95, 143, 0.4);
  color: var(--neon-pink);
}
.video-controls #leave-call:hover {
  background: rgba(255, 95, 143, 0.10);
  box-shadow: 0 6px 16px rgba(255, 95, 143, 0.22);
  color: var(--neon-pink);
  border-color: var(--neon-pink);
}

/* ============ DRAWING (warm pink accent) ============ */
#widget-drawing .widget-bar { background: linear-gradient(120deg, rgba(255, 95, 143, 0.18), rgba(255, 95, 143, 0.05)); }
#widget-drawing .widget-title { color: #e0487a; }

.draw-canvas-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fdfdfd;
  border: 1px solid rgba(255, 95, 143, 0.20);
  box-shadow: inset 0 2px 10px rgba(60, 40, 120, 0.06);
}
#draw-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* Drawing Toolbar */
.draw-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid rgba(255, 95, 143, 0.12);
}
.draw-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.draw-swatch {
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.draw-swatch:hover {
  transform: scale(1.25) !important;
  border-color: var(--neon-pink) !important;
  box-shadow: 0 4px 14px rgba(255, 95, 143, 0.35) !important;
}
.draw-swatch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 95, 143, 0.35);
}
.draw-color-input {
  transition: transform 0.15s ease;
}
.draw-color-input:hover {
  transform: scale(1.15);
}
.draw-tool-btn {
  background: #fff;
  border: 1px solid rgba(120, 100, 170, 0.18);
  color: var(--text-secondary);
  border-radius: 9px;
  transition: all 0.15s ease, transform 0.1s ease;
  box-shadow: 0 1px 4px rgba(90, 70, 140, 0.06);
}
.draw-tool-btn:hover {
  background: #fff !important;
  border-color: var(--neon-pink) !important;
  color: var(--neon-pink) !important;
  box-shadow: 0 4px 12px rgba(255, 95, 143, 0.18);
}
.draw-tool-btn:active {
  transform: scale(0.95);
}
.draw-tool-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 95, 143, 0.30);
}
.draw-tool-btn.active {
  background: rgba(255, 95, 143, 0.14) !important;
  border-color: var(--neon-pink) !important;
  color: var(--neon-pink) !important;
}
.draw-size-btn {
  flex: 0 0 auto;
}
.draw-toolbar {
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.draw-swatch {
  box-shadow: 0 1px 4px rgba(60, 40, 120, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.draw-size-slider {
  accent-color: var(--neon-pink);
}

/* Drawing Gallery */
.draw-gallery {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 95, 143, 0.35) transparent;
}
.draw-gallery::-webkit-scrollbar {
  height: 4px;
}
.draw-gallery::-webkit-scrollbar-track {
  background: transparent;
}
.draw-gallery::-webkit-scrollbar-thumb {
  background: rgba(255, 95, 143, 0.35);
  border-radius: 2px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

/* ============ RESIZE HANDLE ============ */
.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 26px;
  height: 26px;
  cursor: nwse-resize;
  touch-action: none;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.45;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(124, 92, 255, 0.4);
  transition: opacity 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.resize-handle:hover {
  opacity: 1;
  color: var(--neon-pink);
  transform: scale(1.2);
}

/* Floating fullscreen controls overlay */
#video-fullscreen-controls {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 100000;
  gap: 8px;
}
#video-fullscreen-controls.visible { display: flex; }
#video-fullscreen-controls button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(60, 40, 120, 0.25);
}
#video-fullscreen-controls button:hover {
  background: var(--neon-pink);
  color: #fff;
  transform: scale(1.1);
}
#video-fullscreen-controls button:active { transform: scale(0.95); }

/* Go Fullscreen button on mobile in minimized video */
#go-fullscreen-btn {
  display: none;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  background: rgba(124, 92, 255, 0.10) !important;
}
#go-fullscreen-btn.visible { display: block; }

/* ============ TASKBAR ============ */
.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(124, 92, 255, 0.15);
  display: flex;
  align-items: center;
  z-index: 10001;
  padding: 0 8px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  box-shadow: 0 -4px 24px rgba(95, 75, 150, 0.10);
}
.taskbar.visible {
  transform: translateY(0);
}
.taskbar-items {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
}
.taskbar-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(124, 92, 255, 0.08);
  border: 1px solid rgba(124, 92, 255, 0.12);
  transition: all 0.15s ease;
  max-width: 180px;
}
.taskbar-entry:hover {
  background: rgba(124, 92, 255, 0.16);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(124, 92, 255, 0.18);
}
.taskbar-entry-icon {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(124, 92, 255, 0.12);
  border-radius: 5px;
  padding: 1px 4px;
}
.taskbar-entry-label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.taskbar-start,
.taskbar-end {
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.taskbar-showall {
  background: #fff;
  border: 1px solid rgba(124, 92, 255, 0.18);
  color: var(--text-secondary);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-shadow: 0 1px 4px rgba(90, 70, 140, 0.08);
}
.taskbar-showall:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 92, 255, 0.28);
}

/* ============ ACCESSIBILITY ============ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 820px) {
  .widget.maximized {
    position: fixed !important;
    width: 100vw !important;
    height: 100vh !important;
    top: 0 !important;
    left: 0 !important;
  }

  .dock-buttons button,
  .dock-link {
    padding: 10px 16px;
    font-size: 14px;
    min-width: 44px;
    min-height: 44px;
  }

  .draw-swatch {
    width: 34px !important;
    height: 34px !important;
  }
  .draw-size-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 13px !important;
  }
  .draw-tool-btn {
    padding: 8px 14px !important;
    font-size: 14px !important;
    min-height: 44px;
  }
  .draw-color-input {
    width: 36px !important;
    height: 36px !important;
  }
  .draw-size-slider {
    width: 90px !important;
    height: 24px !important;
  }
  .video-controls button {
    padding: 12px 16px;
    font-size: 15px;
    min-height: 44px;
  }

  .taskbar {
    height: 52px;
    padding: 0 4px;
  }
  .taskbar-entry {
    padding: 8px 16px;
    max-width: 160px;
    min-height: 44px;
  }
  .taskbar-entry-label {
    font-size: 13px;
  }

  .win-btn {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }

  .resize-handle {
    width: 36px;
    height: 36px;
  }
}
