/**
 * Main Stylesheet - Design Tokens and Base Styles
 * Plan Viewer Application
 */

/* ===========================
   CSS Variables (Design Tokens)
   =========================== */

:root {
  /* Colors - Dark Theme */
  --color-bg-primary: #1a1a1a;
  --color-bg-secondary: #2d2d2d;
  --color-bg-tertiary: #3d3d3d;
  --color-bg-hover: #4a4a4a;
  --color-text-primary: #ffffff;
  --color-text-secondary: #b0b0b0;
  --color-text-tertiary: #808080;
  --color-accent: #4a9eff;
  --color-accent-hover: #6bb3ff;
  --color-accent-active: #3a8eef;
  --color-star-active: #ffc107;
  --color-star-hover: #ffd54f;
  --color-error: #ff5252;
  --color-error-bg: #3d1f1f;
  --color-success: #4caf50;
  --color-success-bg: #1f3d20;
  --color-warning: #ff9800;
  --color-warning-bg: #3d2f1f;
  --color-info: #2196f3;
  --color-info-bg: #1f2f3d;
  --color-border: #555555;
  --color-border-light: #404040;
  --color-viewport-placeholder: #2a2a2a;

  /* Typography */
  --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, system-ui, -apple-system, sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Layout */
  --toolbar-height: 48px;
  --info-strip-height: 32px;
  --icon-rail-width: 40px;
  --left-panel-width: 300px;
  --left-panel-min-width: 200px;
  --left-panel-max-width: 500px;
  --resize-handle-width: 4px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.5);

  /* Border Radius */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --radius-xl: 8px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  /* Z-index Layers */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-toast: 400;
}

/* Light Theme */
:root[data-theme="light"] {
  /* Colors - Light Theme */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f5f5f5;
  --color-bg-tertiary: #e8e8e8;
  --color-bg-hover: #d8d8d8;
  --color-text-primary: #1a1a1a;
  --color-text-secondary: #4a4a4a;
  --color-text-tertiary: #808080;
  --color-accent: #0066cc;
  --color-accent-hover: #0052a3;
  --color-accent-active: #004080;
  --color-star-active: #f59e0b;
  --color-star-hover: #d97706;
  --color-error: #dc2626;
  --color-error-bg: #fee2e2;
  --color-success: #16a34a;
  --color-success-bg: #dcfce7;
  --color-warning: #ea580c;
  --color-warning-bg: #fed7aa;
  --color-info: #0284c7;
  --color-info-bg: #dbeafe;
  --color-border: #d1d5db;
  --color-border-light: #e5e7eb;
  --color-viewport-placeholder: #d3d3d3;

  /* Shadows - lighter for light theme */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.12);
}

/* ===========================
   Reset and Base Styles
   =========================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===========================
   Typography
   =========================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  cursor: pointer;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

a:active {
  color: var(--color-accent-active);
}

/* ===========================
   Form Elements
   =========================== */

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background-color: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-tertiary);
}

/* ===========================
   Scrollbars
   =========================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-bg-hover);
}

/* ===========================
   Main Layout
   =========================== */

.plan-viewer {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
}

.main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ===========================
   Utility Classes
   =========================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

[hidden] {
  display: none !important;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Disable text selection on UI elements */
.toolbar,
.icon-rail,
.left-panel__header,
.info-strip {
  user-select: none;
  -webkit-user-select: none;
}
