/* CSS Custom Properties (Design Tokens) */
:root {
  /* Colors */
  --color-primary: #33FFFF;
  --color-canvas-bg: #808080;
  --color-room-bg: #FFFFFF;
  --color-text-primary: #333333;
  --color-text-secondary: #666666;
  --color-border: #CCCCCC;
  --color-bg-light: #F8F9FA;
  --color-success: #28A745;
  --color-warning: #FFC107;
  --color-error: #DC3545;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  
  /* Typography */
  --font-size-sm: 12px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 600;
  
  /* Layout */
  --toolbar-height: 60px;
  --sidebar-width: 300px;
  --object-list-width: 250px;
  --border-radius: 4px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 8px rgba(0,0,0,0.15);
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-bounce: 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-primary);
  background-color: var(--color-bg-light);
  height: 100vh;
  overflow: hidden;
}

/* Layout Structure */
.main-content {
  display: grid;
  grid-template-columns: var(--object-list-width) 1fr var(--sidebar-width);
  grid-template-rows: 1fr;
  height: calc(100vh - var(--toolbar-height));
  overflow: hidden;
}

/* Responsive Grid - Hide panels on smaller screens */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr var(--sidebar-width);
  }
  
  .object-list-panel {
    display: none;
  }
}

@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
  }
  
  .json-sidebar {
    display: none;
  }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
}

h3 {
  font-size: var(--font-size-lg);
}

label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  display: block;
  margin-bottom: var(--space-xs);
}

/* Input Elements */
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  font-size: var(--font-size-md);
  font-family: inherit;
  background-color: white;
  transition: border-color var(--transition-fast);
}

input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(51, 255, 255, 0.2);
}

input[type="text"]:invalid,
input[type="number"]:invalid {
  border-color: var(--color-error);
}

/* Button Base Styles */
button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  transition: all var(--transition-fast);
}

button:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.transition-standard {
  transition: all var(--transition-fast);
}

.transition-bounce {
  transition: transform var(--transition-bounce);
}

/* Focus Management */
.focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-light);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

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

/* Loading States */
.loading {
  pointer-events: none;
  opacity: 0.7;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--color-primary);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

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

/* Error States */
.error {
  color: var(--color-error);
  font-size: var(--font-size-sm);
  margin-top: var(--space-xs);
}

.error-border {
  border-color: var(--color-error) !important;
}

/* Success States */
.success {
  color: var(--color-success);
  font-size: var(--font-size-sm);
  margin-top: var(--space-xs);
}

/* Print Styles */
@media print {
  .toolbar,
  .object-list-panel,
  .json-sidebar {
    display: none;
  }
  
  .main-content {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .canvas-container {
    height: auto;
    min-height: 80vh;
  }
}
