/* ── Rydoo Design Language tokens ─────────────────────────────────────────── */

:root {
  /* Primary */
  --color-paris:        #2C275F;
  --color-purple-rain:  #8282DC;
  --color-salmon:       #F7EFE5;

  /* Secondary — feedback */
  --color-green:        #29A37A;
  --color-green-light:  #E6F5EF;
  --color-red:          #E5484D;
  --color-red-light:    #FEECEE;
  --color-yellow:       #F5A623;
  --color-yellow-light: #FEF6E6;
  --color-blue:         #3E8ED0;
  --color-blue-light:   #EAF3FB;

  /* Neutrals */
  --color-gray-900:     #1A1A2E;
  --color-gray-700:     #4A4A68;
  --color-gray-500:     #8E8EA9;
  --color-gray-300:     #C8C8D8;
  --color-gray-200:     #E2E2EC;
  --color-gray-100:     #F4F4F8;
  --color-white:        #FFFFFF;

  /* Typography — Proxima Nova with system fallbacks */
  --font-family: 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Elevation */
  --shadow-sm:  0 1px 3px rgba(44, 39, 95, 0.08);
  --shadow-md:  0 4px 12px rgba(44, 39, 95, 0.10);
  --shadow-lg:  0 8px 24px rgba(44, 39, 95, 0.12);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

/* ── Reset & base ────────────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  color: var(--color-gray-900);
  background: var(--color-gray-100);
  line-height: 1.5;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header / Navbar ─────────────────────────────────────────────────────── */

.navbar {
  background: var(--color-paris);
  color: var(--color-white);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.navbar__brand svg {
  width: 28px;
  height: 28px;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar__status {
  font-size: 0.8125rem;
  color: var(--color-gray-300);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--color-purple-rain);
  color: var(--color-white);
}

.btn--primary:hover {
  background: #7070cc;
}

.btn--ghost {
  background: transparent;
  color: var(--color-white);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ── Main content ────────────────────────────────────────────────────────── */

.main {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 32px 64px;
}

/* ── Stats bar ───────────────────────────────────────────────────────────── */

.stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  flex: 1;
  min-width: 160px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-paris);
  line-height: 1.2;
}

.stat-card__label {
  font-size: 0.8125rem;
  color: var(--color-gray-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 240px;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.875rem;
  background: var(--color-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238E8EA9' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 10-1.397 1.398h-.001l3.85 3.85a1 1 0 001.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 110-10 5 5 0 010 10z'/%3E%3C/svg%3E") 14px center no-repeat;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--color-purple-rain);
  box-shadow: 0 0 0 3px rgba(130, 130, 220, 0.15);
}

.filter-select {
  padding: 10px 16px;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.875rem;
  background: var(--color-white);
  color: var(--color-gray-700);
  cursor: pointer;
}

/* ── Application grid ────────────────────────────────────────────────────── */

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

/* ── Application card ────────────────────────────────────────────────────── */

.app-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.15s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.app-card__header {
  padding: 20px 20px 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.app-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-paris);
  line-height: 1.35;
}

.app-card__description {
  font-size: 0.8125rem;
  color: var(--color-gray-500);
  margin-top: 2px;
  line-height: 1.4;
}

.app-card__body {
  padding: 0 20px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-card__footer {
  border-top: 1px solid var(--color-gray-100);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Badges / pills ──────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge--running {
  background: var(--color-green-light);
  color: var(--color-green);
}

.badge--error {
  background: var(--color-red-light);
  color: var(--color-red);
}

.badge--idle {
  background: var(--color-gray-100);
  color: var(--color-gray-500);
}

.badge--building {
  background: var(--color-yellow-light);
  color: var(--color-yellow);
}

.badge--type {
  background: var(--color-blue-light);
  color: var(--color-blue);
}

.badge--build {
  background: var(--color-gray-100);
  color: var(--color-gray-700);
}

/* ── Info rows ───────────────────────────────────────────────────────────── */

.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--color-gray-700);
}

.info-row svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--color-gray-500);
}

.info-row a {
  color: var(--color-purple-rain);
  text-decoration: none;
}

.info-row a:hover {
  text-decoration: underline;
}

/* ── Links ───────────────────────────────────────────────────────────────── */

.link-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-purple-rain);
  text-decoration: none;
}

.link-icon:hover {
  text-decoration: underline;
}

.link-icon svg {
  width: 14px;
  height: 14px;
}

/* ── Detail panel / modal ────────────────────────────────────────────────── */

.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.5);
  z-index: 200;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.detail-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-panel {
  width: 520px;
  max-width: 100%;
  background: var(--color-white);
  height: 100vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.detail-overlay.open .detail-panel {
  transform: translateX(0);
}

.detail-panel__header {
  position: sticky;
  top: 0;
  background: var(--color-paris);
  color: var(--color-white);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

.detail-panel__header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.detail-panel__close {
  background: none;
  border: none;
  color: var(--color-white);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.detail-panel__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.detail-panel__body {
  padding: 24px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section__title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-gray-500);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-gray-200);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.8125rem;
}

.detail-row__label {
  color: var(--color-gray-500);
}

.detail-row__value {
  color: var(--color-gray-900);
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

/* ── Deployment timeline ─────────────────────────────────────────────────── */

.deploy-list {
  list-style: none;
}

.deploy-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-gray-100);
  font-size: 0.8125rem;
}

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

.deploy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.deploy-dot--done    { background: var(--color-green); }
.deploy-dot--error   { background: var(--color-red); }
.deploy-dot--running { background: var(--color-yellow); }
.deploy-dot--queued  { background: var(--color-gray-300); }

.deploy-info__title {
  color: var(--color-gray-900);
  font-weight: 500;
}

.deploy-info__time {
  color: var(--color-gray-500);
  font-size: 0.75rem;
}

/* ── Loading & empty states ──────────────────────────────────────────────── */

.loading {
  text-align: center;
  padding: 80px 32px;
  color: var(--color-gray-500);
}

.loading__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-gray-200);
  border-top-color: var(--color-purple-rain);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.empty-state {
  text-align: center;
  padding: 60px 32px;
  color: var(--color-gray-500);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  color: var(--color-gray-300);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .main { padding: 20px 16px 48px; }
  .app-grid { grid-template-columns: 1fr; }
  .stats-bar { flex-direction: column; }
  .detail-panel { width: 100%; }
}

/* ── Deploy feed ─────────────────────────────────────────────────────────── */

.deploy-feed {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.deploy-feed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-gray-100);
  font-size: 0.8125rem;
}

.deploy-feed-item:last-child {
  border-bottom: none;
}

.deploy-feed-item__app {
  font-weight: 600;
  color: var(--color-paris);
  min-width: 140px;
}

.deploy-feed-item__status {
  min-width: 60px;
}

.deploy-feed-item__time {
  color: var(--color-gray-500);
  margin-left: auto;
  white-space: nowrap;
}

/* ── Monitoring bar ──────────────────────────────────────────────────────── */

.monitor-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.monitor-metric {
  flex: 1;
  background: var(--color-gray-100);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.monitor-metric__label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-gray-500);
  font-weight: 600;
  margin-bottom: 4px;
}

.monitor-metric__value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-paris);
}

/* ── Container status ────────────────────────────────────────────────────── */

.container-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-gray-100);
  font-size: 0.8125rem;
}

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

.container-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.container-dot--running { background: var(--color-green); }
.container-dot--exited  { background: var(--color-red); }
.container-dot--other   { background: var(--color-gray-300); }
