/* ==========================================================================
   AI-PKM Design System — index.css
   Foundation: Custom Properties, Resets, Layout, Utilities
   ========================================================================== */

/* --------------------------------------------------------------------------
   Custom Properties — Dark Theme (Default)
   -------------------------------------------------------------------------- */
:root {
  /* Backgrounds */
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-tertiary: #1a1a3e;
  --bg-card: rgba(26, 26, 62, 0.6);
  --bg-glass: rgba(26, 26, 62, 0.4);
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-input: rgba(255, 255, 255, 0.06);

  /* Text */
  --text-primary: #e8e8f0;
  --text-secondary: #9898b8;
  --text-tertiary: #6868a0;
  --text-muted: #4a4a78;

  /* Borders */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.15);

  /* Accent */
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);

  /* Category Colors */
  --cat-idea: #f59e0b;
  --cat-idea-bg: rgba(245, 158, 11, 0.12);
  --cat-task: #10b981;
  --cat-task-bg: rgba(16, 185, 129, 0.12);
  --cat-summary: #6366f1;
  --cat-summary-bg: rgba(99, 102, 241, 0.12);
  --cat-meeting: #ec4899;
  --cat-meeting-bg: rgba(236, 72, 153, 0.12);
  --cat-note: #8b5cf6;
  --cat-note-bg: rgba(139, 92, 246, 0.12);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index Scale */
  --z-sidebar: 100;
  --z-header: 200;
  --z-modal: 1000;
  --z-toast: 2000;
}

/* --------------------------------------------------------------------------
   Custom Properties — Light Theme Override
   -------------------------------------------------------------------------- */
[data-theme='light'] {
  --bg-primary: #f5f5ff;
  --bg-secondary: #eeeef8;
  --bg-tertiary: #e4e4f0;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.6);
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-input: rgba(0, 0, 0, 0.04);

  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-tertiary: #7a7a9a;
  --text-muted: #9a9aba;

  --border-color: rgba(0, 0, 0, 0.08);
  --border-active: rgba(0, 0, 0, 0.15);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.1);
}

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

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

/* --------------------------------------------------------------------------
   Custom Scrollbar
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

[data-theme='light'] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
}

[data-theme='light'] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

[data-theme='light'] * {
  scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}

/* --------------------------------------------------------------------------
   Selection
   -------------------------------------------------------------------------- */
::selection {
  background: rgba(99, 102, 241, 0.35);
  color: inherit;
}

::-moz-selection {
  background: rgba(99, 102, 241, 0.35);
  color: inherit;
}

/* --------------------------------------------------------------------------
   Focus Styles
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Base Element Styles
   -------------------------------------------------------------------------- */
a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-secondary);
}

img,
svg {
  display: block;
  max-width: 100%;
}

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

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

ul,
ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

code,
pre {
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   Layout System
   -------------------------------------------------------------------------- */
.app-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 64px 1fr;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  grid-row: 1 / -1;
}

.header {
  grid-column: 2;
}

.main-content {
  grid-column: 2;
  overflow-y: auto;
  padding: 24px 32px;
}

/* --------------------------------------------------------------------------
   Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .app-container {
    grid-template-columns: 1fr;
    grid-template-rows: 56px 1fr;
  }

  .sidebar {
    grid-row: auto;
    grid-column: auto;
  }

  .header {
    grid-column: 1;
  }

  .main-content {
    grid-column: 1;
  }
}

/* --------------------------------------------------------------------------
   Utility Classes — Category Text Colors
   -------------------------------------------------------------------------- */
.text-idea {
  color: var(--cat-idea);
}

.text-task {
  color: var(--cat-task);
}

.text-summary {
  color: var(--cat-summary);
}

.text-meeting {
  color: var(--cat-meeting);
}

.text-note {
  color: var(--cat-note);
}

/* --------------------------------------------------------------------------
   Utility Classes — Category Background Colors
   -------------------------------------------------------------------------- */
.bg-idea {
  background-color: var(--cat-idea-bg);
}

.bg-task {
  background-color: var(--cat-task-bg);
}

.bg-summary {
  background-color: var(--cat-summary-bg);
}

.bg-meeting {
  background-color: var(--cat-meeting-bg);
}

.bg-note {
  background-color: var(--cat-note-bg);
}

/* --------------------------------------------------------------------------
   Utility Classes — Accessibility
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
