/* Desmos Calculator - Enhanced Design */

:root {
  --primary: #00695c;
  --primary-light: #00897b;
  --primary-dark: #004d40;
  --primary-hover: #007a6b;
  --surface: #ffffff;
  --surface-variant: #f8f9fa;
  --surface-hover: #f0f2f5;
  --on-surface: #1a1a1a;
  --on-surface-variant: #5f6368;
  --outline: #dadce0;
  --outline-hover: #bdc1c6;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --radius: 10px;
  --radius-lg: 16px;
  --radius-sm: 6px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset container styles */
.container {
  max-width: 100%;
  padding: 0;
  margin: 0;
}

.content-wrapper {
  max-width: 100%;
  margin: 0;
}

/* Main Layout */
.desmos-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 0;
  min-height: calc(100vh - 120px);
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

/* Sidebar */
.desmos-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--outline);
  padding: 28px;
  overflow-y: auto;
  height: calc(100vh - 120px);
  position: sticky;
  top: 0;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
}

.desmos-sidebar::-webkit-scrollbar {
  width: 6px;
}

.desmos-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.desmos-sidebar::-webkit-scrollbar-thumb {
  background: var(--outline);
  border-radius: 3px;
}

.desmos-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Focus states */
.example-chip:focus,
.function-card:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 105, 92, 0.1);
}

/* Sidebar Sections */
.sidebar-section {
  margin-bottom: 28px;
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--outline), transparent);
}

/* Quick Examples */
.quick-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.example-chip {
  padding: 8px 14px;
  background: var(--surface-variant);
  border: 1.5px solid var(--outline);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  color: var(--on-surface);
  box-shadow: var(--shadow-sm);
}

.example-chip:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.example-chip:active {
  transform: translateY(0);
}

/* Input Groups */
.input-group {
  background: var(--surface);
  border: 1.5px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.input-group:hover {
  border-color: var(--outline-hover);
  box-shadow: var(--shadow-md);
}

.input-group:last-child {
  margin-bottom: 0;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--on-surface);
  margin-bottom: 8px;
}

.input-group md-outlined-text-field {
  width: 100%;
}

/* Action Buttons */
.action-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-group md-filled-button {
  width: 100%;
  --md-filled-button-container-shape: var(--radius-sm);
  --md-filled-button-container-color: var(--primary);
  transition: var(--transition);
}

.action-group md-filled-button:hover {
  --md-filled-button-container-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.action-group-row {
  display: flex;
  gap: 8px;
}

.action-group-row md-assist-chip {
  flex: 1;
  --md-assist-chip-container-color: var(--surface-variant);
  --md-assist-chip-label-text-color: var(--on-surface);
  --md-assist-chip-outline-color: var(--outline);
  transition: var(--transition);
}

.action-group-row md-assist-chip:hover {
  --md-assist-chip-container-color: var(--primary);
  --md-assist-chip-label-text-color: white;
  --md-assist-chip-outline-color: var(--primary);
  transform: translateY(-1px);
}

/* Graph Area */
.desmos-graph-area {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Graph Controls */
.graph-controls {
  display: flex;
  gap: 10px;
  padding: 16px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--outline);
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.graph-controls md-assist-chip {
  --md-assist-chip-container-color: var(--surface-variant);
  --md-assist-chip-label-text-color: var(--on-surface);
  --md-assist-chip-outline-color: var(--outline);
  transition: var(--transition);
}

.graph-controls md-assist-chip:hover {
  --md-assist-chip-container-color: var(--primary);
  --md-assist-chip-label-text-color: white;
  --md-assist-chip-outline-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.graph-controls md-assist-chip.active {
  --md-assist-chip-container-color: var(--primary);
  --md-assist-chip-label-text-color: white;
  --md-assist-chip-outline-color: var(--primary);
}

/* API Status Styles */
.api-status-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.api-status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.status-label {
  font-size: 14px;
  color: var(--on-surface-variant);
  font-weight: 500;
}

.status-indicator {
  font-size: 13px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  text-align: center;
  min-width: 60px;
}

.status-healthy {
  background-color: #e8f5e8;
  color: #2e7d32;
}

.status-warning {
  background-color: #fff3e0;
  color: #ef6c00;
}

.status-error {
  background-color: #ffebee;
  color: #c62828;
}

.status-unknown {
  background-color: #f5f5f5;
  color: #616161;
}

/* API Status Button in Header */
.api-status-header-button {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  color: var(--md-sys-color-primary, #00695c);
  border-radius: var(--md-sys-shape-button);
  padding: 8px 18px;
  background: none;
  transition: background 0.15s, color 0.15s;
  border: none;
  cursor: pointer;
  position: relative;
}

.api-status-header-button:hover {
  background: rgba(0, 105, 92, 0.08);
  color: var(--md-sys-color-primary);
}

.api-status-header-button md-icon {
  font-size: 20px;
}

.api-status-indicator {
  font-size: 13px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  text-align: center;
  min-width: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.calculator-wrapper {
  flex: 1;
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

.calculator-container {
  width: 100%;
  height: 100%;
  min-height: 650px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1.5px solid var(--outline);
  background: var(--surface);
  position: relative;
  transition: var(--transition);
}

.calculator-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  z-index: 1;
}

.calculator-container:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

#calculator {
  width: 100%;
  height: 100%;
  border: none;
}

/* Functions Library */
.functions-library-panel {
  display: none;
  background: var(--surface);
  border: 1.5px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 20px;
  max-height: 550px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.functions-library-panel.active {
  display: block;
}

.functions-library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary);
}

.functions-library-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--on-surface);
  letter-spacing: -0.2px;
}

.functions-library-header md-icon-button {
  --md-icon-button-icon-color: var(--on-surface-variant);
  transition: var(--transition);
}

.functions-library-header md-icon-button:hover {
  --md-icon-button-icon-color: var(--primary);
  transform: rotate(90deg);
}

.functions-search-container {
  margin-bottom: 20px;
  position: relative;
}

.functions-search-container md-filled-text-field {
  width: 100%;
  --md-filled-text-field-container-shape: 28px;
  --md-filled-text-field-container-color: var(--surface-variant);
  --md-filled-text-field-label-text-color: var(--on-surface-variant);
  --md-filled-text-field-input-text-color: var(--on-surface);
  --md-filled-text-field-focus-label-text-color: var(--primary);
  --md-filled-text-field-active-indicator-color: transparent;
  --md-filled-text-field-focus-active-indicator-color: transparent;
  --md-filled-text-field-hover-active-indicator-color: transparent;
  --md-filled-text-field-container-elevation: 0;
  transition: var(--transition);
  border: 1.5px solid transparent;
}

.functions-search-container md-filled-text-field:hover {
  --md-filled-text-field-container-color: var(--surface-hover);
  border-color: var(--outline);
}

.functions-search-container md-filled-text-field:focus-within {
  --md-filled-text-field-container-color: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 105, 92, 0.1), var(--shadow-md);
}

.functions-search-container md-icon {
  color: var(--on-surface-variant);
  transition: var(--transition);
}

.functions-search-container:focus-within md-icon {
  color: var(--primary);
}

.functions-library-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.function-card {
  padding: 14px;
  background: var(--surface-variant);
  border: 1.5px solid var(--outline);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.function-card:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateX(6px);
  box-shadow: var(--shadow-md);
}

.function-card:active {
  transform: translateX(3px);
}

.function-name {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 6px;
  color: inherit;
}

.function-card:hover .function-name {
  color: white;
}

.function-syntax {
  font-family: 'Roboto Mono', 'Courier New', monospace;
  font-size: 0.75rem;
  opacity: 0.85;
  color: inherit;
}

.function-card:hover .function-syntax {
  opacity: 0.95;
}

/* Status Messages */
.status-message {
  display: none;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-top: 14px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.status-message.success {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  color: #1b5e20;
  border-left: 4px solid #4caf50;
  box-shadow: var(--shadow-sm);
}

.status-message.error {
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
  color: #b71c1c;
  border-left: 4px solid #f44336;
  box-shadow: var(--shadow-sm);
}

.status-message.active {
  display: block;
}

/* Instructions */
.instructions {
  background: linear-gradient(135deg, var(--surface-variant) 0%, var(--surface) 100%);
  border: 1.5px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 18px;
  font-size: 0.875rem;
  line-height: 1.7;
  box-shadow: var(--shadow-sm);
}

.instructions strong {
  color: var(--primary);
  font-weight: 600;
  display: block;
  margin-bottom: 10px;
  font-size: 0.9375rem;
}

.instructions ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}

.instructions li {
  margin-bottom: 6px;
  color: var(--on-surface-variant);
}

.instructions code {
  background: var(--surface);
  padding: 3px 7px;
  border-radius: 4px;
  font-family: 'Roboto Mono', 'Courier New', monospace;
  font-size: 0.85em;
  border: 1px solid var(--outline);
  color: var(--primary);
  font-weight: 500;
}

/* Page Header */
.page-header {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-variant) 100%);
  border-bottom: 2px solid var(--outline);
  padding: 24px 32px;
  box-shadow: var(--shadow-sm);
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: var(--on-surface);
  letter-spacing: -0.3px;
}

.page-header p {
  font-size: 0.9375rem;
  color: var(--on-surface-variant);
  margin: 0;
  font-weight: 400;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .desmos-layout {
    grid-template-columns: 1fr;
  }

  .desmos-sidebar {
    border-right: none;
    border-bottom: 2px solid var(--outline);
    height: auto;
    position: static;
    max-height: 60vh;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }

  .desmos-graph-area {
    min-height: 600px;
  }

  .calculator-container {
    min-height: 550px;
  }
}

@media (max-width: 768px) {
  .desmos-sidebar {
    padding: 16px;
  }

  .graph-controls {
    padding: 12px 16px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .calculator-wrapper {
    padding: 16px;
  }

  .calculator-container {
    min-height: 500px;
  }

  .page-header {
    padding: 16px;
  }

  .page-header h1 {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .desmos-sidebar {
    padding: 12px;
  }

  .graph-controls {
    padding: 10px 12px;
    gap: 6px;
  }

  .graph-controls md-assist-chip {
    font-size: 0.75rem;
  }

  .calculator-wrapper {
    padding: 12px;
  }

  .calculator-container {
    min-height: 400px;
  }

  .input-group {
    padding: 12px;
  }

  .action-group-row {
    flex-direction: column;
  }
}

/* Material Design Overrides */
.filter-chip-style {
  --md-assist-chip-container-color: transparent;
  --md-assist-chip-label-text-color: var(--on-surface);
  --md-assist-chip-outline-color: var(--outline);
}

#llm-status {
  display: none;
}

#llm-status.active {
  display: block;
}




















