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

:root {
  --bg: #f0f2f5;
  --sidebar-bg: #1a1a2e;
  --sidebar-hover: #16213e;
  --sidebar-active: #0f3460;
  --primary: #1976d2;
  --primary-hover: #1565c0;
  --danger: #d32f2f;
  --success: #2e7d32;
  --warning: #ed6c02;
  --text: #333;
  --text-muted: #888;
  --card-bg: #fff;
  --border: #e0e0e0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-icon {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 8px;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.login-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(25,118,210,.1);
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #fdecea;
  border-radius: 6px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: #e8eaf0;
  color: var(--text);
}
.btn-secondary:hover { background: #d5d8e0; }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #c62828; }

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn .material-icons-outlined { font-size: 18px; }

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: #ccc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand .material-icons-outlined {
  font-size: 28px;
  color: var(--primary);
}

.sidebar-brand strong {
  display: block;
  color: #fff;
  font-size: 15px;
}

.sidebar-brand small {
  font-size: 11px;
  color: #888;
}

.nav-menu {
  list-style: none;
  padding: 12px 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background .15s;
  margin-bottom: 2px;
}

.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item .material-icons-outlined { font-size: 20px; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  color: #999;
  font-size: 13px;
  font-family: inherit;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.05); color: #fff; }

.main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.topbar h2 { font-size: 18px; font-weight: 600; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.content {
  padding: 24px;
  flex: 1;
}

.page { display: none; }
.page.active { display: block; }

/* ── Dashboard Cards ─────────────────────────────────────────────────────── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.service-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
}

.service-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.service-card-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.running { background: var(--success); box-shadow: 0 0 6px rgba(46,125,50,.4); }
.status-dot.stopped { background: var(--danger); }

.service-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.service-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.service-info-row .label { color: var(--text-muted); }
.service-info-row .value { font-weight: 500; font-family: 'Courier New', monospace; font-size: 12px; }

.service-actions {
  display: flex;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.skeleton-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  height: 200px;
  animation: pulse 1.5s infinite;
}

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

/* ── Deploy ──────────────────────────────────────────────────────────────── */
.deploy-header { margin-bottom: 20px; }
.deploy-header h3 { font-size: 18px; margin-bottom: 4px; }
.text-muted { color: var(--text-muted); font-size: 13px; }

.deploy-repos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.repo-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.repo-card h4 {
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.repo-card .commit-info {
  font-size: 12px;
  color: var(--text-muted);
}

.repo-card .commit-hash {
  font-family: 'Courier New', monospace;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.deploy-actions {
  margin-bottom: 20px;
}

.deploy-progress {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.deploy-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.deploy-progress-header h4 { font-size: 15px; }

.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.running { background: #e3f2fd; color: var(--primary); }
.badge.done { background: #e8f5e9; color: var(--success); }
.badge.error { background: #fdecea; color: var(--danger); }
.badge.idle { background: #f5f5f5; color: var(--text-muted); }

.step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
}

.step-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-icon.running {
  background: var(--primary);
  animation: pulse 1s infinite;
}

.step-icon.done { background: var(--success); }
.step-icon.error { background: var(--danger); }

.step-icon .material-icons-outlined {
  font-size: 14px;
  color: #fff;
}

.step-msg { color: var(--text); }
.step-msg.error { color: var(--danger); }

/* ── Logs ────────────────────────────────────────────────────────────────── */
.logs-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--card-bg);
  min-width: 160px;
}

.logs-viewer {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 70vh;
  overflow-y: auto;
}

/* ── Settings ────────────────────────────────────────────────────────────── */
.info-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.info-card h3 {
  font-size: 15px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid #f5f5f5;
}

.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-muted); font-weight: 500; }

.info-row .value {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 4px;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-row .value a {
  color: var(--primary);
  text-decoration: none;
}
.info-row .value a:hover { text-decoration: underline; }

/* ── Como Funciona ───────────────────────────────────────────────────────── */
.howto-intro {
  margin-bottom: 28px;
}
.howto-intro h3 { font-size: 20px; margin-bottom: 4px; }

.howto-section {
  margin-top: 40px;
}
.howto-section h3 {
  font-size: 18px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

/* Flow Diagram */
.flow-diagram {
  max-width: 700px;
}

.flow-step {
  display: flex;
  gap: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.flow-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.flow-icon .material-icons-outlined { font-size: 26px; color: #fff; }
.flow-icon.dev     { background: #5c6bc0; }
.flow-icon.sync    { background: #1976d2; }
.flow-icon.patch   { background: #f57c00; }
.flow-icon.build   { background: #7b1fa2; }
.flow-icon.deploy  { background: #0288d1; }
.flow-icon.live    { background: var(--success); }

.flow-content h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}
.flow-content p {
  font-size: 13px;
  color: #555;
  line-height: 1.6;
}
.flow-content code {
  background: #eef;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #5c6bc0;
}

.flow-arrow {
  display: flex;
  justify-content: center;
  padding: 6px 0 6px 24px;
  color: #bbb;
}
.flow-arrow .material-icons-outlined { font-size: 22px; }

/* Repos chips */
.flow-repos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.flow-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
}
.flow-chip .material-icons-outlined { font-size: 16px; color: var(--primary); }
.flow-chip small { color: var(--text-muted); font-weight: 400; }

/* Patch details */
.flow-details {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.flow-detail-item {
  display: flex;
  gap: 10px;
  background: var(--bg);
  border-radius: 8px;
  padding: 12px;
}
.flow-detail-item > .material-icons-outlined {
  font-size: 20px;
  color: var(--primary);
  margin-top: 2px;
  flex-shrink: 0;
}
.flow-detail-item strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}
.flow-detail-item ul {
  list-style: none;
  padding: 0;
}
.flow-detail-item li {
  font-size: 12px;
  color: #666;
  padding: 2px 0;
  padding-left: 14px;
  position: relative;
}
.flow-detail-item li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  opacity: .4;
}

/* Tech tags */
.flow-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.flow-tag {
  background: #f3e5f5;
  color: #7b1fa2;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* Links */
.flow-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.flow-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  background: #e3f2fd;
  padding: 6px 14px;
  border-radius: 6px;
  transition: background .15s;
}
.flow-link:hover { background: #bbdefb; }
.flow-link .material-icons-outlined { font-size: 16px; }

/* Architecture Grid */
.arch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.arch-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.arch-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.arch-card-icon .material-icons-outlined { font-size: 28px; color: #fff; }
.arch-card-icon.frontend { background: #43a047; }
.arch-card-icon.backend  { background: #1565c0; }
.arch-card-icon.database { background: #ef6c00; }
.arch-card-icon.proxy    { background: #6a1b9a; }

.arch-card h4 { font-size: 14px; margin-bottom: 4px; }
.arch-card p { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.arch-port {
  display: inline-block;
  font-size: 11px;
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Tips Grid */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.tip-card {
  display: flex;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.tip-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}
.tip-icon.tip-info { color: var(--primary); }
.tip-icon.tip-warning { color: var(--warning); }

.tip-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}
.tip-card p {
  font-size: 12px;
  color: #666;
  line-height: 1.5;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  z-index: 999;
  animation: slideIn .3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }

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