/* ============================================
   STRANGELY FILED STUDIO
   Classified Documentary Aesthetic
   ============================================ */

:root {
  --navy: #0D1B2A;
  --charcoal: #1B263B;
  --cream: #F5F0E6;
  --red: #C1121F;
  --cyan: #00B4D8;
  --cyan-dim: rgba(0, 180, 216, 0.15);
  --cream-dim: rgba(245, 240, 230, 0.08);
  --border: rgba(245, 240, 230, 0.12);
  --text-muted: rgba(245, 240, 230, 0.55);
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--navy);
  color: var(--cream);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
  position: relative;
}

/* Subtle scanline + grid for classified feel */
.scanline {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  z-index: 9999;
}

.grid-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 180, 216, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 180, 216, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 0;
}

/* ========== TOP BAR ========== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.5rem;
  background: var(--charcoal);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-mark {
  width: 38px;
  height: 38px;
  background: var(--red);
  color: var(--cream);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.05em;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.studio-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  color: var(--cream);
}

.studio-sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--cyan);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.status-indicators {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

.status-dot.online {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.divider {
  opacity: 0.3;
}

/* ========== DASHBOARD LAYOUT ========== */
.dashboard {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: calc(100vh - 110px);
  position: relative;
  z-index: 1;
}

/* ========== CONTROL PANEL ========== */
.control-panel {
  background: var(--charcoal);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.section-title .accent {
  color: var(--cyan);
  margin-right: 0.4rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

textarea,
input[type="text"],
select {
  background: var(--navy);
  border: 1px solid var(--border);
  color: var(--cream);
  padding: 0.65rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  border-radius: 2px;
  resize: vertical;
  transition: border-color 0.2s;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--cyan);
}

textarea::placeholder,
input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%00B4D8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* Buttons */
.primary-btn,
.secondary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 2px;
}

.primary-btn {
  background: var(--red);
  color: var(--cream);
}

.primary-btn:hover:not(:disabled) {
  background: #a00e19;
  box-shadow: 0 0 20px rgba(193, 18, 31, 0.4);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-btn {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
}

.secondary-btn:hover:not(:disabled) {
  background: var(--cyan-dim);
}

.btn-icon {
  font-size: 0.7rem;
}

.text-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  cursor: pointer;
  text-align: left;
  padding: 0.3rem 0;
  letter-spacing: 0.05em;
}

.text-btn:hover {
  color: var(--red);
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--cyan-dim);
  border: 1px solid rgba(0, 180, 216, 0.3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cyan);
}

.loading.hidden {
  display: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 180, 216, 0.3);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Error */
.error-box {
  padding: 0.75rem;
  background: rgba(193, 18, 31, 0.15);
  border: 1px solid var(--red);
  color: #ff8a8a;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  line-height: 1.4;
}

.error-box.hidden {
  display: none;
}

/* Project list */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
}

.project-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.65rem;
  background: var(--navy);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s;
  font-size: 0.8rem;
}

.project-item:hover {
  border-color: var(--cyan);
}

.project-item .title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 0.5rem;
}

.project-item .date {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}

.empty-state {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ========== RESULTS PANEL ========== */
.results-panel {
  padding: 1.5rem;
  overflow-y: auto;
  background: var(--navy);
}

.welcome-state {
  max-width: 560px;
  margin: 4rem auto;
  text-align: center;
}

.welcome-mark {
  width: 64px;
  height: 64px;
  background: var(--red);
  color: var(--cream);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  letter-spacing: 0.05em;
}

.welcome-state h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-bottom: 0.75rem;
}

.welcome-state > p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.feature-list {
  list-style: none;
  text-align: left;
  margin: 0 auto 1.5rem;
  max-width: 380px;
}

.feature-list li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
  color: var(--cream);
}

.feature-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--cyan);
}

.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Results container */
.results-container.hidden {
  display: none;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.results-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.icon-btn {
  background: var(--charcoal);
  border: 1px solid var(--border);
  color: var(--cream);
  padding: 0.45rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s;
}

.icon-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.icon-btn.primary {
  background: var(--cyan);
  color: var(--navy);
  border-color: var(--cyan);
  font-weight: 600;
}

.icon-btn.primary:hover {
  background: #00c4e8;
}

/* Tabs */
.tab-nav {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0;
}

.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab:hover {
  color: var(--cream);
}

.tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Content styling inside tabs */
.tab-pane h3 {
  font-size: 1rem;
  color: var(--cyan);
  margin: 1.5rem 0 0.6rem;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

.tab-pane h3:first-child {
  margin-top: 0;
}

.tab-pane h4 {
  font-size: 0.9rem;
  color: var(--cream);
  margin: 1rem 0 0.4rem;
}

.tab-pane p,
.tab-pane li {
  font-size: 0.9rem;
  line-height: 1.65;
  color: rgba(245, 240, 230, 0.9);
}

.tab-pane ul,
.tab-pane ol {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.tab-pane pre,
.prompt-block {
  background: var(--charcoal);
  border: 1px solid var(--border);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0.5rem 0 1rem;
  position: relative;
}

.copy-inline {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--navy);
  border: 1px solid var(--border);
  color: var(--cyan);
  font-size: 0.65rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-family: var(--font-mono);
}

.copy-inline:hover {
  border-color: var(--cyan);
}

.scene-card {
  background: var(--charcoal);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.scene-card .scene-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cyan);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.meta-item {
  background: var(--charcoal);
  border: 1px solid var(--border);
  padding: 0.75rem;
}

.meta-item .label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.meta-item .value {
  font-size: 0.9rem;
  font-weight: 500;
}

/* ========== FOOTER ========== */
.bottom-bar {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 1.5rem;
  background: var(--charcoal);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .control-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
  }

  .top-bar {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .status-indicators {
    font-size: 0.65rem;
  }

  .bottom-bar {
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
  }
}

@media (max-width: 520px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .results-header {
    flex-direction: column;
  }

  .action-buttons {
    width: 100%;
  }

  .icon-btn {
    flex: 1;
    text-align: center;
  }
}

/* Utility */
.hidden {
  display: none !important;
}
