/* ============================================
   BRACKET APP — MAIN CSS
   Variables, Reset, Base Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Colors — Dark Mode (Default) */
  --bg-primary: #000000;
  --bg-secondary: #111114;
  --bg-tertiary: #1a1a1e;
  --bg-card: #111114;
  --bg-card-hover: #1a1a1e;
  --bg-glass: rgba(7, 7, 10, 0.7);

  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-tertiary: rgba(255, 255, 255, 0.35);
  --text-inverse: #000000;

  --accent: #068afa;
  --accent-hover: #0578d8;
  --accent-bright: #45abff;
  --accent-indigo: #5c7cff;
  --accent-green: #4ade80;
  --accent-green-bg: rgba(74, 222, 128, 0.12);
  --accent-red: #f87171;
  --accent-red-bg: rgba(248, 113, 113, 0.12);
  --accent-orange: #fbbf24;
  --accent-yellow: #ffd60a;
  --accent-purple: #a78bfa;
  --accent-pink: #ff375f;

  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);
  --divider: rgba(255, 255, 255, 0.06);
  --shadow: rgba(0, 0, 0, 0.4);
  --shadow-lg: rgba(0, 0, 0, 0.6);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-hover: rgba(255, 255, 255, 0.08);

  --live-red: #f87171;
  --live-pulse: rgba(248, 113, 113, 0.4);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, Helvetica, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Helvetica Neue", sans-serif;

  --font-size-xs: 11px;
  --font-size-sm: 13px;
  --font-size-base: 15px;
  --font-size-md: 17px;
  --font-size-lg: 20px;
  --font-size-xl: 22px;
  --font-size-2xl: 28px;
  --font-size-3xl: 34px;
  --font-size-4xl: 40px;

  --spacing-1: 4px;
  --spacing-2: 8px;
  --spacing-3: 12px;
  --spacing-4: 16px;
  --spacing-5: 20px;
  --spacing-6: 24px;
  --spacing-8: 32px;
  --spacing-10: 40px;
  --spacing-12: 48px;

  --header-height: 56px;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);

  --transition-fast: 0.15s cubic-bezier(0.2, 0, 0, 1);
  --transition-base: 0.25s cubic-bezier(0.2, 0, 0, 1);
  --transition-slow: 0.4s cubic-bezier(0.2, 0, 0, 1);
  --transition-spring: 0.5s cubic-bezier(0.32, 0.72, 0, 1);

  --z-base: 1;
  --z-header: 100;
  --z-modal: 200;
  --z-toast: 300;
  --z-canvas: 0;

  /* Legacy Home Aliases */
  --bg: var(--bg-primary);
  --surface: var(--bg-secondary);
  --surface-2: var(--bg-tertiary);
  --surface-3: #1c1c21;
  --text: var(--text-primary);
  --text-2: var(--text-secondary);
  --text-3: var(--text-tertiary);
  --blue: var(--accent);
  --blue-bright: var(--accent-bright);
  --indigo: var(--accent-indigo);
  --violet: var(--accent-purple);
  --green: var(--accent-green);
  --red: var(--accent-red);
  --amber: var(--accent-orange);
  --header-h: var(--header-height);
  --nav-h: 68px;
}

/* Light Mode */
[data-theme="light"] {
  --bg-primary: #F2F2F7;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #E5E5EA;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F2F2F7;
  --bg-glass: rgba(255, 255, 255, 0.8);

  --text-primary: #000000;
  --text-secondary: #3C3C43;
  --text-tertiary: #8E8E93;
  --text-inverse: #FFFFFF;

  --border: rgba(0, 0, 0, 0.1);
  --border-light: rgba(0, 0, 0, 0.15);
  --divider: rgba(0, 0, 0, 0.08);
  --shadow: rgba(0, 0, 0, 0.08);
  --shadow-lg: rgba(0, 0, 0, 0.12);
  --glass: rgba(255, 255, 255, 0.6);
  --glass-hover: rgba(0, 0, 0, 0.06);
  --live-pulse: rgba(248, 113, 113, 0.3);

  /* Legacy Home Aliases - Light */
  --bg: var(--bg-primary);
  --surface: var(--bg-secondary);
  --surface-2: var(--bg-tertiary);
  --surface-3: #E5E5EA;
  --text: var(--text-primary);
  --text-2: var(--text-secondary);
  --text-3: var(--text-tertiary);
  --blue: var(--accent);
  --green: var(--accent-green);
  --red: var(--accent-red);
  --amber: var(--accent-orange);
  --glass: rgba(0, 0, 0, 0.04);
  --glass-hover: rgba(0, 0, 0, 0.08);
  --glass-border: rgba(0, 0, 0, 0.08);
}

/* ============================================
   ANIMATED CANVAS BACKGROUND
   ============================================ */

#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: var(--z-canvas);
  pointer-events: none;
}

/* ============================================
   RESET
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background-color var(--transition-base), color var(--transition-base);
}

html,
body {
  overflow-y: auto;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul,
ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ============================================
   SELECTION
   ============================================ */

::selection {
  background: rgba(6, 138, 250, 0.3);
  color: #FFFFFF;
}

/* ============================================
   FOCUS STATES
   ============================================ */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-primary {
  color: var(--text-primary);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-tertiary {
  color: var(--text-tertiary);
}

.text-accent {
  color: var(--accent);
}

.text-green {
  color: var(--accent-green);
}

.text-red {
  color: var(--accent-red);
}

.text-orange {
  color: var(--accent-orange);
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.font-medium {
  font-weight: 500;
}

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

.flex {
  display: flex;
}

.stack {
  display: flex;
  flex-direction: column;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.flex-1 {
  flex: 1;
}

.gap-1 {
  gap: var(--spacing-1);
}

.gap-2 {
  gap: var(--spacing-2);
}

.gap-3 {
  gap: var(--spacing-3);
}

.gap-4 {
  gap: var(--spacing-4);
}

.gap-6 {
  gap: var(--spacing-6);
}

.gap-8 {
  gap: var(--spacing-8);
}

.gap-10 {
  gap: var(--spacing-10);
}

.gap-12 {
  gap: var(--spacing-12);
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.inset-0 {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.overflow-hidden {
  overflow: hidden;
}

.overflow-auto {
  overflow: auto;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rounded-sm {
  border-radius: var(--radius-sm);
}

.rounded-md {
  border-radius: var(--radius-md);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

.rounded-xl {
  border-radius: var(--radius-xl);
}

.rounded-2xl {
  border-radius: var(--radius-2xl);
}

.rounded-full {
  border-radius: var(--radius-full);
}

.cursor-pointer {
  cursor: pointer;
}

.pointer-events-none {
  pointer-events: none;
}

.select-none {
  user-select: none;
}

/* ============================================
   PAGE CONTAINER
   ============================================ */

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: calc(var(--safe-area-top) + var(--header-height) + 12px);
  padding-bottom: calc(var(--safe-area-bottom) + 88px);
  padding-left: var(--spacing-4);
  padding-right: var(--spacing-4);
  max-width: 600px;
  margin: 0 auto;
  animation: pageIn 0.4s cubic-bezier(0.2, 0, 0, 1);
}

.container {
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.container-wide {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
