/* Catpuccin Latte Color Palette */
:root {
  /* Catpuccin Latte Colors */
  --rosewater: #dc8a78;
  --flamingo: #dd7878;
  --pink: #ea76cb;
  --mauve: #8839ef;
  --red: #d20f39;
  --maroon: #e64553;
  --peach: #fe640b;
  --yellow: #df8e1d;
  --green: #40a02b;
  --teal: #179299;
  --sky: #04a5e5;
  --sapphire: #209fb5;
  --blue: #1e66f5;
  --lavender: #7287fd;
  
  /* Neutral Colors */
  --text: #4c4f69;
  --subtext1: #5c5f77;
  --subtext0: #6c6f85;
  --overlay2: #7c7f93;
  --overlay1: #8c8fa1;
  --overlay0: #9ca0b0;
  --surface2: #acb0be;
  --surface1: #bcc0cc;
  --surface0: #ccd0da;
  --crust: #dce0e8;
  --mantle: #e6e9ef;
  --base: #eff1f5;
  
  /* Custom Variables */
  --bg-primary: #ffffff;
  --bg-secondary: var(--base);
  --bg-tertiary: var(--mantle);
  --border-color: var(--surface0);
  --shadow: rgba(76, 79, 105, 0.1);
  
  /* Font */
  --font-mono: 'PressStart2P', 'Courier New', monospace;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 8-bit Font Import */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Inter:wght@300;400;500;600;700&display=swap');

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

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-mono);
  color: var(--mauve);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

h1 { font-size: 16px; }
h2 { font-size: 14px; }
h3 { font-size: 12px; }
h4 { font-size: 10px; }

.text-accent { color: var(--peach); }
.text-success { color: var(--green); }
.text-warning { color: var(--yellow); }
.text-error { color: var(--red); }
.text-info { color: var(--blue); }
.text-muted { color: var(--subtext0); }

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.header {
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--mauve);
  text-decoration: none;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: var(--surface0);
  color: var(--mauve);
}

.nav-link.active {
  background: var(--mauve);
  color: white;
}

/* Main Content */
.main {
  min-height: calc(100vh - 80px);
  padding: 2rem 0;
}

.page-title {
  margin-bottom: 2rem;
  text-align: center;
}

/* Grid System */
.grid {
  display: grid;
  gap: 1rem;
}

.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px var(--shadow);
  transition: all 0.2s ease;
}

.card:hover {
  border-color: var(--mauve);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow);
}

.card-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 12px;
  margin-bottom: 0.5rem;
}

.card-subtitle {
  color: var(--subtext0);
  font-size: 12px;
}

/* Buttons */
.btn {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.75rem 1.5rem;
  border: 2px solid;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: all 0.2s ease;
  min-width: 120px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  border-color: var(--mauve);
  color: var(--mauve);
}

.btn-primary:hover {
  background: var(--mauve);
  color: white;
}

.btn-success {
  border-color: var(--green);
  color: var(--green);
}

.btn-success:hover {
  background: var(--green);
  color: white;
}

.btn-warning {
  border-color: var(--yellow);
  color: var(--yellow);
}

.btn-warning:hover {
  background: var(--yellow);
  color: white;
}

.btn-danger {
  border-color: var(--red);
  color: var(--red);
}

.btn-danger:hover {
  background: var(--red);
  color: white;
}

.btn-info {
  border-color: var(--blue);
  color: var(--blue);
}

.btn-info:hover {
  background: var(--blue);
  color: white;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 8px;
  min-width: 80px;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 12px;
  min-width: 160px;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  font-size: 12px;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--mauve);
}

.form-control:invalid {
  border-color: var(--red);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236c6f85' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Range Sliders */
.range-group {
  margin-bottom: 1.5rem;
}

.range-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.range-value {
  font-family: var(--font-mono);
  color: var(--mauve);
  font-size: 10px;
  background: var(--surface0);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.range-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--surface0);
  outline: none;
  -webkit-appearance: none;
}

.range-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--mauve);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 4px var(--shadow);
}

.range-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--mauve);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 4px var(--shadow);
}

/* Status & Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.alert-success {
  background-color: #dcf4e8;
  color: #166534;
  border-color: #bbf7d0;
}

.alert-error {
  background-color: #fde8e8;
  color: #991b1b;
  border-color: #fecaca;
}

.alert-warning {
  background-color: #fef3c7;
  color: #92400e;
  border-color: #fed7aa;
}

.alert-info {
  background-color: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}

/* Collapsible Panels */
.collapsible-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease;
  user-select: none;
}

.collapsible-header:hover {
  background-color: var(--surface-light);
}

.collapse-arrow {
  transition: transform 0.2s ease;
  font-size: 0.8em;
  color: var(--text-muted);
}

.collapsible-content {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.collapsible-content.collapsed {
  max-height: 0;
  padding: 0;
}

.collapsed .collapse-arrow {
  transform: rotate(-90deg);
}

/* Session Audio List */
.session-audio-item {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem;
}

.session-audio-item:last-child {
  border-bottom: none;
}

.audio-item-content {
  width: 100%;
}

.audio-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 1rem;
}

.audio-item-meta {
  font-size: 0.8em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.audio-item-text-full {
  background-color: var(--surface-light);
  border-radius: 6px;
  padding: 0.5rem;
  font-size: 0.9em;
  color: var(--text-primary);
  border-left: 3px solid var(--mauve);
  word-wrap: break-word;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.audio-item-request-id {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8em;
  color: var(--text-muted);
}

.audio-item-request-id code {
  background-color: var(--surface);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85em;
  color: var(--text-primary);
}

.audio-control-small {
  width: 180px;
  height: 28px;
}

/* Session Actions */
.session-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
}

.stat-number {
  font-family: var(--font-mono);
  font-size: 24px;
  color: var(--mauve);
  display: block;
  margin-bottom: 0.5rem;
}

.stat-label {
  color: var(--subtext0);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Audio Player */
.audio-player {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Loading */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--surface0);
  border-radius: 50%;
  border-top-color: var(--mauve);
  animation: spin 1s ease-in-out infinite;
}

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

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.hidden { display: none; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Responsive Design */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
  }
  
  .nav-links {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .nav-brand {
    font-size: 1rem;
  }
  
  .page-title {
    font-size: 1.5rem;
  }
  
  .audio-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .audio-controls {
    width: 100%;
    justify-content: flex-start;
  }
  
  .audio-control-small {
    width: 100%;
    max-width: 300px;
  }
}
