@import "tailwindcss";
@import "tw-animate-css";

:root {
  --background-plot: white;
  --background-modal: hsla(0, 0%, 95%, 0.7);
  --modal-shadow: hsla(0, 0%, 95%, 0.7);
  --modal-gradient: hsla(0, 0%, 80%, 1);
  --modal-p: hsla(0, 0%, 0%, 0.5);
  --text-plot: hsla(0, 0%, 89%, 1);
  --accent-1: gold;
  --accent-2: hsla(0, 0%, 0%, 1);
  --accent-3: hsla(0, 0%, 0%, 0.1);
  --button-hover: hsla(0, 0%, 38%, 1);
  --text-heading: hsla(0, 0%, 10%, 1);
  --text-paragraph: hsla(0, 0%, 29%, 1);
  --text-link: hsla(0, 0%, 15%, 1);
  --text-disabled: rgba(121, 121, 121, 0.377);
  --text-link-hover: hsla(0, 0%, 13%, 1);
  /* added by https://ui.shadcn.com */
  --radius: 0.625rem;
  --background: white;
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: oklch(0.205 0 0);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
  /* App background gradient (overridable per theme) */
  --app-background: linear-gradient(to bottom right, #f3f3f3, #e7e7e7);
  /* Glass effect variables */
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-shadow: rgba(0, 0, 0, 0.1);
}

/* Light Theme */
[data-theme='light'] {
  --background: white;
  --foreground: hsla(0, 0%, 9%, 1);
  --background-plot: white;
  --text-plot: hsl(0, 0%, 2%);
  --background-modal: hsla(0, 0%, 95%, 0.7);
  --modal-shadow: hsla(0, 0%, 95%, 0.7);
  --modal-gradient: hsla(0, 0%, 80%, 1);
  --modal-p: hsla(0, 0%, 0%, 0.5);
  --accent-1: gold;
  --accent-2: hsla(0, 0%, 95%, 1);
  --accent-3: hsla(0, 0%, 0%, 0.1);
  --background-funding: hsla(0, 0%, 95%, 1);
  --toggle-hover: hsla(0, 0%, 51%, 1);
  --text-heading: hsla(0, 0%, 10%, 1);
  --text-paragraph: hsla(0, 0%, 29%, 1);
  --text-link: hsla(0, 0%, 15%, 1);
  --text-link-hover: hsla(0, 0%, 13%, 1);
  --app-background: linear-gradient(to bottom right, #f3f3f3, #e7e7e7);
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.25);
  --glass-shadow: rgba(0, 0, 0, 0.15);
}

/* Dark Theme */
[data-theme='dark'] {
  --background-plot: hsla(0, 0%, 0%, 0.3);
  --text-plot: hsl(0, 0%, 98%);
  --background-modal: hsla(0, 0%, 0%, 0.65);
  --modal-shadow: hsla(0, 0%, 0%, 0.2);
  --modal-gradient: hsla(0, 0%, 0%, 1);
  --modal-p: hsla(0, 0%, 100%, 0.5);
  --background-funding: hsla(0, 0%, 15%, 1);
  --toggle-hover: gold;
  --accent-1: gold;
  --accent-2: hsla(0, 0%, 20%, 1);
  --accent-3: hsla(0, 0%, 20%, 0.6);
  --text-heading: hsla(0, 0%, 100%, 0.9);
  --text-paragraph: hsla(0, 0%, 100%, 0.7);
  --text-link: hsla(55, 17%, 86%, 0.8);
  --text-link-hover: hsla(0, 0%, 100%, 1);
  --button-hover: hsla(0, 0%, 20%, 1);
  /* added by https://ui.shadcn.com */
  --background: rgb(29, 29, 29);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
  --chart-1: oklch(0.488 0.243 264.376);
  --chart-2: oklch(0.696 0.17 162.48);
  --chart-3: oklch(0.769 0.188 70.08);
  --chart-4: oklch(0.627 0.265 303.9);
  --chart-5: oklch(0.645 0.246 16.439);
  --sidebar: oklch(0.205 0 0);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.488 0.243 264.376);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.269 0 0);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
  --sidebar-ring: oklch(0.556 0 0);
  --app-background: linear-gradient(to bottom right, #2a2a2a, #1c1c1c);
  --glass-bg: rgba(0, 0, 0, 0.2);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: rgba(0, 0, 0, 0.3);
}

/* Height fix for mobile browser UI */
html, body {
  min-height: 100vh;   /* fallback */
  min-height: 100svh;  /* stable (with chrome) */
  min-height: 100dvh;  /* dynamic (preferred) */
}

body {
  font-size: 12px;
  font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif
}

.canvas {
  display: block;
  width: 100vw;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 0;

  /* Same height strategy */
  height: 100vh;
  height: 100svh;
  height: 100dvh;
}

.canvas-title {
  position: absolute;
  top: 2rem;
  left: 2rem;
  max-width: 60%;
  padding: 0.25rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--background) 60%, transparent);
  z-index: 1;
}
.canvas-title p {
  display: none;
  padding: 0.25rem;
  background-image: linear-gradient(-125deg, var(--background) 0%, var(--background-modal) 100%);
  max-height: 50vh;
  border-radius: 10px;
  overflow-y: auto;
  z-index: 1;
}

.canvas-title:hover p {
  display: block;
}

ul {
  list-style-type: disc;
  padding-left: 2rem;
  margin: 0.5rem 0;
  color: var(--text-paragraph);
  font-size: 14px;
}

li {
  padding: 0.25rem 0;
  font-size: 13px;
}

.button {
  background-color: var(--accent-2);
  border: none;
  padding: 0.25rem 1rem;
  border-radius: 0.25rem;
  margin-top: 0.5rem;
  cursor: pointer;
}
.button:hover {
  background-color: var(--button-hover);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-heading);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 0.5em;
}

p {
  color: var(--text-paragraph);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 1em;
}

a[href] {
  color: var(--text-link);
  position: relative;
  text-decoration: none;
}

a[href]::after {
  content: '';
  position: absolute;
  width: 0;
  height: 1px;
  bottom: -1px;
  left: 0;
  background-color: var(--text-link-hover);
  transition: width 0.3s;
}

a[href]:hover {
  color: var(--text-link-hover);
}

a[href]:hover::after {
  width: 100%;
}

/* Custom tweakpane containers */
.data-stores-pane {
  position: fixed;
  top: 2.75rem;
  right: 0.35rem;
  z-index: 11;
  transition: opacity 0.5s ease;
}

.data-stores-pane::before {
  content: '';
  position: absolute;
  top: -0.25rem;
  right: 0.5rem;
  width: 10px;
  height: 10px;
  background-color: var(--foreground);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
  animation: pulse 2s ease-in-out infinite;
}

.data-stores-pane:not(:hover)::before {
  opacity: 1;
}

.data-stores-pane:hover::before {
  opacity: 0;
  pointer-events: none;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(2.5);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.data-stores-pane:hover {
  opacity: 1;
}

.data-stores-pane:not(:hover) {
  opacity: 0.6;
}

.data-settings-pane{
  position: fixed;
  top: 8rem;
  right: 0.35rem;
  z-index: 10;
}

.plot-pane{
  position: fixed;
  top: 17rem;
  right: 0.35rem;
  z-index: 10;
}

.plot-cloud{
  position: fixed;
  top: 17rem;
  right: 0.35rem;
  z-index: 10;
}

.line-plot-pane{
  position: absolute;
  bottom: 25.5%;
  right: 0.35rem;
  z-index: 10;
}

.analysis-tp{
  position: absolute;
  bottom: 20%;
  right: 0.5rem;
  z-index: 10;
}

.analysis {
  position: fixed;
  top: 3rem;
  left: 3%;
  z-index: 10;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@theme inline {
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
  --color-sidebar: var(--sidebar);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-ring: var(--sidebar-ring);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
  }
}