/* ========================================
   MindStudio Hub - digitalnomad.coffee Design System
   ======================================== */

/* === CSS Custom Properties === */
:root {
  --primary: #6F4120;
  --bg: #FAE0D1;
  --fg: #25201D;
  --card: #FDEEE7;
  --card-hover: #FBE0D2;
  --muted: #DDB398;
  --border: #E3BEAB;
  --accent: #F6C5AC;
  --gold: #FBDB8D;
  --success: rgba(74,222,128,.7);
  --rose: #D4736C;
  --vanilla: #F9EEE2;
  --blush: #F8C5AD;
  --caramel: #C4956A;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --shadow-sm: 0 1px 2px rgba(37,32,29,0.06);
  --shadow-md: 0 4px 12px rgba(37,32,29,0.1);
  --shadow-lg: 0 8px 24px rgba(37,32,29,0.12);
  --font-heading: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

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

html {
  scroll-behavior: smooth;
}

/* ========================================
   Body & Typography
   ======================================== */

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--fg);
  line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

.mono, code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background-color: var(--card);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius);
}

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

a:hover {
  color: var(--caramel);
}

p {
  margin-bottom: 1rem;
}

/* ========================================
   Navigation
   ======================================== */

.navbar {
  background-color: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.navbar-brand:hover {
  color: var(--caramel);
}

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

.nav-links a {
  color: var(--fg);
  font-weight: 500;
  text-decoration: none;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.nav-links a:hover {
  opacity: 1;
  color: var(--primary);
}

/* ========================================
   Container & Layout
   ======================================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

main {
  padding: 2rem 0;
  min-height: calc(100vh - 200px);
}

.page-header {
  padding: 3rem 0 2rem;
  text-align: center;
}

.page-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.page-header p {
  color: var(--muted);
  font-size: 1.1rem;
}

/* ========================================
   Agent Grid & Cards
   ======================================== */

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
  padding: 2rem 0;
}

.agent-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  transition: all 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  color: var(--fg);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.4s ease both;
}

.agent-card:nth-child(1) { animation-delay: 0.05s; }
.agent-card:nth-child(2) { animation-delay: 0.1s; }
.agent-card:nth-child(3) { animation-delay: 0.15s; }
.agent-card:nth-child(4) { animation-delay: 0.2s; }
.agent-card:nth-child(5) { animation-delay: 0.25s; }
.agent-card:nth-child(n+6) { animation-delay: 0.3s; }

.agent-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--muted);
}

.agent-card .icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background-color: var(--accent);
  opacity: 0.2;
}

.agent-card h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.agent-card .tagline {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-style: italic;
}

.agent-card .description {
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0.8;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.agent-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Color variants for icon backgrounds */
.agent-card.color-rose .icon {
  background-color: rgba(212, 115, 108, 0.15);
}

.agent-card.color-vanilla .icon {
  background-color: rgba(249, 238, 226, 0.6);
}

.agent-card.color-blush .icon {
  background-color: rgba(248, 197, 173, 0.3);
}

.agent-card.color-caramel .icon {
  background-color: rgba(196, 149, 106, 0.15);
}

/* ========================================
   Badges
   ======================================== */

.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-category {
  background-color: rgba(246, 197, 172, 0.3);
  color: var(--primary);
}

.badge-status-completed {
  background-color: rgba(74, 222, 128, 0.15);
  color: #166534;
}

.badge-status-running {
  background-color: rgba(251, 219, 141, 0.25);
  color: #92400e;
}

.badge-status-failed {
  background-color: rgba(212, 115, 108, 0.15);
  color: #991b1b;
}

.badge-status-pending {
  background-color: var(--vanilla);
  color: var(--muted);
}

/* ========================================
   Agent Detail / Hero
   ======================================== */

.agent-hero {
  background-color: var(--card);
  border-radius: var(--radius-xl);
  padding: 3rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
}

.agent-hero .icon-large {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.agent-hero h1 {
  font-size: 2.5rem;
}

.agent-hero .tagline {
  font-style: italic;
  color: var(--muted);
  font-size: 1.2rem;
  margin-top: 0.5rem;
}

/* ========================================
   Action Pipeline Visualization
   ======================================== */

.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1.5rem 0;
}

.pipeline-step {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  transition: all 0.2s ease;
}

.pipeline-step:hover {
  background-color: var(--card-hover);
  border-color: var(--muted);
}

.pipeline-arrow {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ========================================
   Forms
   ======================================== */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background-color: white;
  color: var(--fg);
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(111, 65, 32, 0.1);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--fg);
  color: var(--bg);
}

.btn-primary:hover {
  background-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
  background-color: var(--card);
  border-color: var(--muted);
}

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
}

/* ========================================
   Run Detail / Results
   ======================================== */

.run-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.step-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.step-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-left: 2px solid var(--border);
  position: relative;
  animation: fadeIn 0.3s ease both;
}

.step-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 1.25rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--success);
  border: 2px solid var(--card);
}

.step-item.failed::before {
  background-color: var(--rose);
}

.step-item .step-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.step-item .step-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.step-item .step-preview {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-top: 0.5rem;
  max-width: 600px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   Stats Bar
   ======================================== */

.stats-bar {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  min-width: 160px;
  flex: 1;
}

.stat-card .stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* ========================================
   Progress Bar
   ======================================== */

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--caramel));
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* ========================================
   Connections List
   ======================================== */

.connections {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.connection-tag {
  background-color: var(--vanilla);
  color: var(--primary);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ========================================
   History Table
   ======================================== */

.history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.history-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}

.history-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.history-table tr:hover td {
  background-color: var(--card);
}

/* ========================================
   Section Headers
   ======================================== */

.section-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ========================================
   Footer
   ======================================== */

.footer {
  text-align: center;
  padding: 3rem 0;
  margin-top: 4rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer a {
  color: var(--primary);
}

.footer a:hover {
  color: var(--caramel);
}

/* ========================================
   Utility Classes
   ======================================== */

.text-muted {
  color: var(--muted);
}

.text-mono {
  font-family: var(--font-mono);
}

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

/* Margin utilities */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 2.5rem; }
.mt-6 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 2.5rem; }
.mb-6 { margin-bottom: 3rem; }

/* Flex utilities */
.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

/* ========================================
   Empty States
   ======================================== */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

.empty-state .icon {
  font-size: 3rem;
  opacity: 0.5;
  margin-bottom: 1rem;
}

/* ========================================
   Animations
   ======================================== */

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

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  .agent-grid {
    grid-template-columns: 1fr;
  }

  .navbar {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
  }

  .nav-links {
    gap: 1rem;
    width: 100%;
    justify-content: center;
  }

  .agent-hero {
    padding: 2rem;
  }

  .agent-hero h1 {
    font-size: 2rem;
  }

  .stats-bar {
    flex-direction: column;
  }

  .stat-card {
    min-width: auto;
  }

  .pipeline {
    justify-content: center;
  }

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

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.2rem; }

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

  .container {
    padding: 0 1rem;
  }
}

@media (max-width: 480px) {
  .agent-card {
    padding: 1.5rem;
  }

  .navbar-brand {
    font-size: 1.25rem;
  }

  .nav-links {
    flex-direction: column;
    gap: 0.5rem;
  }

  .agent-hero {
    padding: 1.5rem;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    padding: 0.6rem 0.8rem;
    font-size: 16px;
  }

  .btn {
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
  }

  .history-table {
    font-size: 0.8rem;
  }

  .history-table th,
  .history-table td {
    padding: 0.5rem 0.75rem;
  }
}
