@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@300;400;700;800&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  --bg-base: #0A0B0A;
  --bg-surface: rgba(17, 19, 16, 0.82);
  --bg-surface-solid: #111310;
  --bg-elevated: #181A16;
  --bg-input: #0E0F0D;
  --border: rgba(204, 213, 174, 0.12);
  --border-strong: rgba(204, 213, 174, 0.18);
  --text-primary: #FEFAE0;
  --text-secondary: #A8AD9B;
  --text-muted: #6F7563;
  --accent: #CCD5AE;
  --accent-hover: #D8E0BE;
  --accent-active: #B8C49A;
  --accent-success: #7A8F5A;
  --accent-warning: #D4A373;
  --accent-danger: #8B3A3A;
  --accent-danger-hover: #A04545;
  --accent-danger-bg: rgba(139, 58, 58, 0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --font-sans: 'Almarai', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-mono: 'SFMono-Regular', Consolas, Monaco, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.video-bg,
.bg-overlay,
.noise {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.video-bg {
  z-index: -3;
  overflow: hidden;
}

.video-bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85) contrast(1.05);
}

.bg-overlay {
  z-index: -2;
  background: linear-gradient(135deg, rgba(10,11,10,0.92) 0%, rgba(14,15,13,0.88) 60%, rgba(10,11,10,0.86) 100%);
}

.noise {
  z-index: -1;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 150ms ease-out;
}

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

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 180ms ease-out;
  box-shadow: var(--shadow-sm);
}

button:hover, .btn:hover {
  background: #1f211c;
  border-color: rgba(204, 213, 174, 0.22);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

button:active, .btn:active { transform: translateY(0); }

button:focus-visible, .btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px rgba(204, 213, 174, 0.35);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-base);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--bg-base);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-secondary);
}

.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }

.btn-danger {
  background: transparent;
  border-color: rgba(139, 58, 58, 0.55);
  color: #d98a8a;
}

.btn-danger:hover {
  background: rgba(139, 58, 58, 0.18);
  border-color: #8B3A3A;
  color: #f3b6b6;
}

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 24px; font-size: 15px; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.navbar {
  border-bottom: 1px solid var(--border);
  background: rgba(17, 19, 16, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.navbar-brand .logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.navbar-brand .logo-mark svg { stroke-width: 2.4px; }

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-nav a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
}

.navbar-nav a:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.05);
  margin-left: 6px;
}

.user-pill .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
}

.font-medium { font-weight: 700; }

main { padding: 42px 0 80px; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.page-header h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.page-header p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 15px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.card + .card { margin-top: 20px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  text-align: left;
  padding: 12px 14px;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong);
}

tbody td {
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:hover td { background: rgba(255,255,255,0.04); }

tbody tr:last-child td { border-bottom: none; }

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-static {
  background: rgba(122, 143, 90, 0.12);
  color: var(--accent-success);
}

.badge-live {
  background: rgba(204, 213, 174, 0.12);
  color: var(--accent);
}

.badge-none {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.actions form { display: inline; }

.empty-state {
  text-align: center;
  padding: 72px 24px;
}

.empty-icon {
  color: var(--accent);
  margin-bottom: 18px;
}

.empty-state h2 {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
}

.empty-state p {
  margin: 0 auto 26px;
  color: var(--text-secondary);
  max-width: 420px;
}

.repo-list {
  display: grid;
  gap: 14px;
}

.repo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: border-color 180ms ease, transform 180ms ease;
}

.repo-item:hover { border-color: rgba(204, 213, 174, 0.22); transform: translateY(-1px); }

.repo-item-selected {
  border-color: var(--accent);
  background: rgba(204, 213, 174, 0.08);
}

.repo-item .name {
  font-weight: 800;
  font-size: 15px;
  color: var(--text-primary);
}

.repo-item .meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.version-list {
  display: grid;
  gap: 12px;
}

.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.version-item .time {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.success-card {
  max-width: 560px;
  margin: 56px auto 0;
  text-align: center;
}

.success-card h1 {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 400;
}

.success-card p {
  color: var(--text-secondary);
  margin: 0 0 28px;
}

.success-card .big-link {
  display: inline-block;
  font-size: 16px;
  font-weight: 700;
  padding: 13px 26px;
  background: var(--accent);
  color: var(--bg-base);
  border-radius: var(--radius-pill);
}

.success-card .big-link:hover { background: var(--accent-hover); }

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-card .logo-lg {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--bg-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  color: var(--text-primary);
}

.login-card p {
  margin: 0 0 30px;
  color: var(--text-secondary);
}

.login-card .btn-primary { width: 100%; }

.login-footer {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-right: 6px;
}

.status-dot.live { background: var(--accent-success); box-shadow: 0 0 8px rgba(122, 143, 90, 0.5); }
.status-dot.static { background: var(--accent); }
.status-dot.paused { background: var(--text-muted); }

/* Deploy overlay & animation — kept light/cream as requested for uploads */
.deploy-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #FDFCF7;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 500ms ease, visibility 500ms ease;
  overflow: hidden;
}

.deploy-overlay.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.deploy-video-bg,
.deploy-noise {
  position: absolute;
  inset: 0;
}

.deploy-video-bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
}

.deploy-noise {
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.deploy-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  text-align: center;
}

.deploy-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(143, 168, 90, 0.18);
  border-top-color: #8FA85A;
  margin: 0 auto 18px;
  animation: spin 1s linear infinite;
}

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

.deploy-text {
  font-family: var(--font-serif);
  font-size: 26px;
  color: #2C2419;
  letter-spacing: 0.01em;
  min-width: 220px;
}

/* Result modal */
.result-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 11, 10, 0.55);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.result-modal.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.result-card {
  width: 100%;
  max-width: 420px;
  background: rgba(253, 252, 247, 0.96);
  border: 1px solid #e3dac9;
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.result-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 16px;
}

.result-icon.success { background: rgba(143, 168, 90, 0.14); color: #6B7F42; }
.result-icon.error { background: rgba(176, 80, 80, 0.12); color: #a14a4a; }

.result-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  color: #2C2419;
}

.result-card p {
  color: #6F7563;
  margin: 0 0 24px;
}

@media (max-width: 720px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .repo-item, .version-item { flex-direction: column; align-items: flex-start; }
  .actions { width: 100%; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tbody td { display: flex; justify-content: space-between; padding: 12px 14px; border: none; border-bottom: 1px solid var(--border); }
  tbody td::before { content: attr(data-label); color: var(--text-muted); font-size: 11px; text-transform: uppercase; font-weight: 800; }
  tbody tr { margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
  .deploy-stage { top: 50%; }
  .deploy-text { font-size: 22px; }
}
