/* Theme Colors extracted from Stitch Design */
:root {
  /* Primary Colors */
  --color-background: #131614;
  --color-surface: #2c352f;
  --color-border: #414e46;
  --color-text-primary: #ffffff;
  --color-text-secondary: #a3b2a9;

  /* Typography */
  --font-family-primary: 'Inter', 'Noto Sans', sans-serif;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 700;
  --font-weight-black: 900;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;

  /* Border Radius */
  --border-radius-sm: 0.375rem;
  --border-radius-md: 0.5rem;
  --border-radius-lg: 0.75rem;
  --border-radius-xl: 1rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family-primary);
  background-color: var(--color-background);
  color: var(--color-text-primary);
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

/* Layout Utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-1 {
  flex: 1;
}

.items-center {
  align-items: center;
}

.items-end {
  align-items: end;
}

.justify-center {
  justify-content: center;
}

.justify-items-center {
  justify-items: center;
}

.gap-2 {
  gap: var(--spacing-sm);
}

.gap-4 {
  gap: var(--spacing-md);
}

.gap-6 {
  gap: var(--spacing-lg);
}

/* Spacing Utilities */
.p-4 {
  padding: var(--spacing-md);
}

.p-6 {
  padding: var(--spacing-lg);
}

.px-4 {
  padding-left: var(--spacing-md);
  padding-right: var(--spacing-md);
}

.px-40 {
  padding-left: 2.5rem;
  padding-right: 2.5rem;
}

.py-2 {
  padding-top: var(--spacing-sm);
  padding-bottom: var(--spacing-sm);
}

.py-4 {
  padding-top: var(--spacing-md);
  padding-bottom: var(--spacing-md);
}

.py-5 {
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.py-6 {
  padding-top: var(--spacing-lg);
  padding-bottom: var(--spacing-lg);
}

.pt-4 {
  padding-top: var(--spacing-md);
}

.pb-2 {
  padding-bottom: var(--spacing-sm);
}

/* Sizing Utilities */
.size-full {
  width: 100%;
  height: 100%;
}

.min-h-screen {
  min-height: 100vh;
}

.min-w-72 {
  min-width: 18rem;
}

.min-w-\[158px\] {
  min-width: 158px;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

/* Typography */
.text-white {
  color: var(--color-text-primary);
}

.text-\[#a3b2a9\] {
  color: var(--color-text-secondary);
}

.text-base {
  font-size: 1rem;
}

.text-lg {
  font-size: 1.125rem;
}

.text-2xl {
  font-size: 1.5rem;
}

.text-\[13px\] {
  font-size: 13px;
}

.font-medium {
  font-weight: var(--font-weight-medium);
}

.font-bold {
  font-weight: var(--font-weight-bold);
}

.leading-normal {
  line-height: 1.5;
}

.leading-tight {
  line-height: 1.25;
}

.tracking-\[-0\.015em\] {
  letter-spacing: -0.015em;
}

.tracking-\[0\.015em\] {
  letter-spacing: 0.015em;
}

.tracking-light {
  letter-spacing: 0.025em;
}

/* Borders and Backgrounds */
.border {
  border-width: 1px;
  border-style: solid;
}

.border-\[#414e46\] {
  border-color: var(--color-border);
}

.border-\[#a3b2a9\] {
  border-color: var(--color-text-secondary);
}

.border-t-2 {
  border-top-width: 2px;
}

.bg-\[#2c352f\] {
  background-color: var(--color-surface);
}

.rounded-xl {
  border-radius: var(--border-radius-xl);
}

/* Grid */
.grid {
  display: grid;
}

.grid-flow-col {
  grid-auto-flow: column;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-rows-\[1fr_auto\] {
  grid-template-rows: 1fr auto;
}

.min-h-\[180px\] {
  min-height: 180px;
}

/* Main Container Layout */
.main-container {
  min-height: 100vh;
  background-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
}

.centered-content {
  background-color: rgba(40, 40, 40, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-xl);
  padding: var(--spacing-lg) var(--spacing-2xl) var(--spacing-xl)
    var(--spacing-2xl);
  max-width: 600px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

/* Layout Components */
.layout-container {
  display: flex;
  height: 100%;
  flex-grow: 1;
  flex-direction: column;
}

.layout-content-container {
  display: flex;
  flex-direction: column;
  max-width: 960px;
  flex: 1;
}

/* Chart Bars */
.chart-bar {
  border: 2px solid var(--color-text-secondary);
  background-color: var(--color-surface);
  width: 100%;
}

/* Responsive Design */
@media (max-width: 768px) {
  .px-40 {
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
  }

  .min-w-72 {
    min-width: 100%;
  }

  .min-w-\[158px\] {
    min-width: 100%;
  }
}

/* Dark mode support (already dark by default) */
@media (prefers-color-scheme: light) {
  :root {
    --color-background: #ffffff;
    --color-surface: #f8f9fa;
    --color-border: #e9ecef;
    --color-text-primary: #212529;
    --color-text-secondary: #6c757d;
  }
}

/* Component Classes */
.card {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  border-radius: var(--border-radius-xl);
  padding: var(--spacing-lg);
  border: 1px solid var(--color-border);
  background-color: var(--color-background);
}

.metric-card {
  display: flex;
  min-width: 158px;
  flex: 1;
  flex-direction: column;
  gap: var(--spacing-sm);
  border-radius: var(--border-radius-xl);
  padding: var(--spacing-lg);
  border: 1px solid var(--color-border);
}

.chart-container {
  display: flex;
  min-width: 18rem;
  flex: 1;
  flex-direction: column;
  gap: var(--spacing-sm);
  border-radius: var(--border-radius-xl);
  border: 1px solid var(--color-border);
  padding: var(--spacing-lg);
}

.chart-grid {
  display: grid;
  min-height: 180px;
  grid-auto-flow: column;
  gap: var(--spacing-lg);
  grid-template-rows: 1fr auto;
  align-items: end;
  justify-items: center;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.chart-bar {
  border: 2px solid var(--color-text-secondary);
  background-color: var(--color-surface);
  width: 100%;
}

.chart-label {
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  line-height: 1.5;
  letter-spacing: 0.015em;
}

/* Alert Components */
.alert-container {
  background-color: #282828;
  border-radius: var(--border-radius-xl);
  padding: var(--spacing-xl);
  margin: var(--spacing-xl) 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  background-color: #333333;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--color-border);
}

.alert:last-child {
  margin-bottom: 0;
}

.alert-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
}

.alert.success .alert-icon {
  color: var(--color-text-primary);
}

.alert.info .alert-icon {
  color: var(--color-text-primary);
}

.alert.error .alert-icon {
  color: #ff6b6b;
  background-color: rgba(255, 107, 107, 0.1);
}

.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-title {
  color: var(--color-text-primary);
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--spacing-xs) 0;
  line-height: 1.4;
}

.alert.error .alert-title {
  color: #ff6b6b;
}

.alert-description {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin: 0;
  line-height: 1.5;
}

.alert-list {
  margin: var(--spacing-sm) 0 0 0;
  padding-left: var(--spacing-md);
  list-style: none;
}

.alert-list li {
  color: #ff6b6b;
  font-size: 0.875rem;
  margin-bottom: var(--spacing-xs);
  position: relative;
  padding-left: var(--spacing-sm);
}

.alert-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 4px;
  height: 4px;
  background-color: #ff6b6b;
  border-radius: 50%;
}

.alert-list li:last-child {
  margin-bottom: 0;
}

/* Step Sections */
.step-section {
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.step-section::before {
  content: attr(data-step);
  position: absolute;
  top: 50%;
  right: -20px;
  transform: translateY(-50%);
  font-size: 12rem;
  font-weight: var(--font-weight-black);
  color: rgba(255, 255, 255, 0.03);
  line-height: 1;
  z-index: 0;
  pointer-events: none;
}

.step-section[data-step='1']::before {
  content: '1';
}

.step-section[data-step='2']::before {
  content: '2';
}

.step-section[data-step='3']::before {
  content: '3';
}

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

.step-number {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    var(--color-surface),
    var(--color-border)
  );
  color: var(--color-text-primary);
  font-size: 2rem;
  font-weight: var(--font-weight-black);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

.step-content {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.step-content h2 {
  margin-top: 0;
  margin-bottom: var(--spacing-sm);
}

.step-content p {
  margin-bottom: var(--spacing-md);
  opacity: 0.9;
}

/* Theme Button Styles */
button {
  font-size: 1.2em;
  padding: 0.75em 2em;
  margin-top: 1em;
  background: linear-gradient(
    135deg,
    var(--color-surface),
    var(--color-border)
  );
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: var(--font-weight-medium);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  width: 100%;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s ease;
}

button:hover {
  background: linear-gradient(
    135deg,
    var(--color-border),
    var(--color-surface)
  );
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

button:hover::before {
  left: 100%;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

button:disabled:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Pulse animation for login button */
@keyframes pulse-border {
  0% {
    border-color: var(--color-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }
  50% {
    border-color: #d4af37;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
  }
  100% {
    border-color: var(--color-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }
}

.pulse-border {
  animation: pulse-border 2s ease-in-out infinite;
}

/* Additional Component Styles */
pre {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  padding: 1em;
  border-radius: var(--border-radius-md);
  white-space: pre-wrap;
  word-wrap: break-word;
  border: 1px solid var(--color-border);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-x: auto;
  position: relative;
  max-height: 200px;
  overflow-y: hidden;
}

pre::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--color-surface) 80%);
  pointer-events: none;
  border-radius: 0 0 var(--border-radius-md) var(--border-radius-md);
}

/* Code Block Container and Actions */
.code-block-container {
  position: relative;
  margin-bottom: var(--spacing-md);
  transition: filter 0.3s ease;
}

.code-block-container:hover pre {
  filter: blur(8px);
  background-color: rgba(19, 22, 20, 0.8);
}

.code-block-container:hover pre::after {
  display: none;
}

.code-actions {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateY(-10px);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10;
  filter: none !important;
}

.code-block-container:hover .code-actions {
  opacity: 1;
  transform: translate(-50%, -50%) translateY(0);
}

.code-action-btn {
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(
    135deg,
    var(--color-surface),
    var(--color-border)
  );
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  background-color: rgba(44, 53, 47, 0.9);
  min-width: 120px;
  filter: none !important;
}

.code-action-btn:hover {
  background: linear-gradient(
    135deg,
    var(--color-border),
    var(--color-surface)
  );
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.code-action-btn:active {
  transform: translateY(0);
}

/* Full Script Container */
.full-script-container {
  margin-bottom: var(--spacing-md);
}

.button-group {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}

.back-btn {
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(
    135deg,
    var(--color-surface),
    var(--color-border)
  );
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  width: fit-content;
}

.back-btn:hover {
  background: linear-gradient(
    135deg,
    var(--color-border),
    var(--color-surface)
  );
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.back-btn:active {
  transform: translateY(0);
}

.copy-btn {
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(
    135deg,
    var(--color-surface),
    var(--color-border)
  );
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  width: fit-content;
}

.copy-btn:hover {
  background: linear-gradient(
    135deg,
    var(--color-border),
    var(--color-surface)
  );
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.copy-btn:active {
  transform: translateY(0);
}

.copy-btn.copied {
  background: linear-gradient(135deg, #8fbc8f, #6b8e6b);
  color: var(--color-text-primary);
}

#fullScriptOutput {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: auto;
}

/* Code Syntax Highlighting */
pre .comment {
  color: var(--color-text-secondary);
  font-style: italic;
  opacity: 0.8;
}

pre .keyword {
  color: #a3b2a9;
  font-weight: var(--font-weight-medium);
}

pre .string {
  color: #8fbc8f;
  font-weight: var(--font-weight-medium);
}

pre .function {
  color: #d4af37;
  font-weight: var(--font-weight-medium);
}

pre .operator {
  color: #cd853f;
}

pre .number {
  color: #deb887;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
  margin-bottom: 10px;
}

.header-container h1 {
  margin-top: 0;
  margin-bottom: 0;
}

.status-text {
  font-size: 0.875rem;
  opacity: 0.8;
}

#status {
  font-weight: bold;
  color: #ff6b6b;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

a {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-text-primary);
}
