/* Alflora Portal — matches the marketing site aesthetic */

:root {
  --cream: #DEDBC8;
  --cream-text: #E1E0CC;
  --card: #101010;
  --feature: #212121;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --green: #22c55e;
  --red: #ef4444;
  --pull-up: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

html, body {
  min-height: 100vh;
  background: #000;
  color: #E1E0CC;
  font-family: 'Almarai', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* Page shell */
.page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}
@media (min-width: 768px) { .page { padding: 1.5rem; } }

.page-frame {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 2rem);
  border-radius: 1rem;
  overflow: hidden;
  background: linear-gradient(160deg, #0c0b08 0%, #14130e 50%, #0a0906 100%);
  display: flex;
  flex-direction: column;
}
@media (min-width: 768px) { .page-frame { border-radius: 2rem; min-height: calc(100vh - 3rem); } }

.page-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
}
.page-gradient {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0.75));
}
.noise-overlay {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  opacity: 0.7; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Nav pill */
.nav-pill {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  z-index: 4;
  display: flex; align-items: center; gap: 0.75rem;
  background: #000;
  border-bottom-left-radius: 1rem;
  border-bottom-right-radius: 1rem;
  padding: 0.5rem 1rem;
}
@media (min-width: 640px) { .nav-pill { gap: 1.5rem; } }
@media (min-width: 768px) { .nav-pill { border-bottom-left-radius: 1.5rem; border-bottom-right-radius: 1.5rem; padding: 0.5rem 2rem; gap: 3rem; } }
.nav-pill a {
  font-size: 10px;
  color: rgba(225, 224, 204, 0.8);
  transition: color 0.2s ease;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.nav-pill a:hover { color: #E1E0CC; }
.nav-pill a svg { width: 12px; height: 12px; }
@media (min-width: 640px) { .nav-pill a { font-size: 0.75rem; } .nav-pill a svg { width: 14px; height: 14px; } }
@media (min-width: 768px) { .nav-pill a { font-size: 0.875rem; } }

/* Auth card */
.auth-main {
  position: relative; z-index: 3;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5rem 1rem 2rem;
}
@media (min-width: 768px) { .auth-main { padding: 6rem 1.5rem 3rem; } }

.card {
  width: 100%;
  max-width: 26rem;
  background: rgba(16, 16, 16, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(222, 219, 200, 0.12);
  border-radius: 1.5rem;
  padding: 2rem 1.5rem;
  animation: cardIn 0.9s var(--pull-up) 0.15s both;
}
@media (min-width: 640px) { .card { padding: 2.5rem; border-radius: 2rem; } }

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

.label {
  display: block;
  color: var(--cream);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 0.75rem;
}
@media (min-width: 640px) { .label { font-size: 0.75rem; } }

h1 {
  font-size: 1.875rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #E1E0CC;
  margin-bottom: 0.5rem;
}
@media (min-width: 640px) { h1 { font-size: 2.25rem; } }

.subtitle {
  color: var(--gray-400);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

/* Forms */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: 0.7rem;
  color: var(--gray-400);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(222, 219, 200, 0.18);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  color: #E1E0CC;
  font-family: 'Almarai', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.form-input::placeholder { color: var(--gray-500); }
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--cream);
  background: rgba(0,0,0,0.55);
}
.form-input.invalid { border-color: var(--red); }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}
.form-select option { background: #151515; color: #E1E0CC; }
.form-textarea {
  min-height: 220px;
  resize: vertical;
  font-family: 'Fira Code', ui-monospace, monospace;
  line-height: 1.45;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
}
@media (min-width: 480px) { .form-row { grid-template-columns: 1fr 1fr; } }

.checkbox {
  display: flex; align-items: flex-start; gap: 0.6rem;
  font-size: 0.8rem; color: var(--gray-400); line-height: 1.4;
  margin: 1rem 0 1.25rem;
}
.checkbox input {
  width: 1rem; height: 1rem;
  accent-color: var(--cream);
  margin-top: 0.15rem;
  flex-shrink: 0;
}
.checkbox a { color: var(--cream); text-decoration: underline; text-underline-offset: 2px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 0.55rem 0.55rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: gap 0.25s ease, filter 0.2s ease, background 0.2s ease;
  font-family: 'Almarai', sans-serif;
}
.btn:hover { gap: 0.75rem; }
.btn-primary { background: var(--cream); color: #000; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-outline {
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(222,219,200,0.25);
  padding: 0.55rem 1.5rem;
}
.btn-outline:hover { border-color: var(--cream); background: rgba(222,219,200,0.06); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-circle {
  width: 2.25rem; height: 2.25rem;
  background: #000;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.25s ease;
}
.btn:hover .btn-circle { transform: scale(1.1); }
.btn-circle svg { width: 14px; height: 14px; color: var(--cream); }

.text-link {
  background: none; border: none; color: var(--cream); cursor: pointer;
  font-size: 0.8rem; text-decoration: underline; text-underline-offset: 2px;
  padding: 0; font-family: 'Almarai', sans-serif;
}

.error {
  color: var(--red);
  font-size: 0.8rem;
  margin-top: 0.3rem;
  min-height: 1.2em;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.alert-error { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-success { background: rgba(34, 197, 94, 0.1); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.2); }

.auth-footer {
  text-align: center;
  color: var(--gray-500);
  font-size: 0.85rem;
  margin-top: 1.25rem;
}
.auth-footer a { color: var(--cream); font-weight: 500; }

.page-footer {
  position: relative; z-index: 3;
  padding: 1rem;
  text-align: center;
  color: var(--gray-500);
  font-size: 0.75rem;
}
@media (min-width: 768px) { .page-footer { padding: 1.5rem; } }

/* Dashboard layout */
.dashboard {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  min-height: calc(100vh - 2rem);
}
@media (min-width: 768px) { .dashboard { min-height: calc(100vh - 3rem); } }

.sidebar {
  width: 260px;
  background: rgba(0,0,0,0.45);
  border-right: 1px solid rgba(222,219,200,0.1);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}
@media (max-width: 900px) {
  .sidebar { width: 64px; align-items: center; padding: 1rem 0.5rem; }
  .sidebar .brand-text, .sidebar .nav-label, .sidebar .user-meta, .sidebar .plan-badge-text { display: none; }
  .sidebar .user-card { display: none; }
}

.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-weight: 700; font-size: 1.1rem;
  margin-bottom: 2rem;
}
.brand-mark {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--cream);
  color: #000;
  border-radius: 6px;
  font-size: 0.85rem;
}

.nav { display: flex; flex-direction: column; gap: 0.25rem; }
.nav a {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  color: rgba(225,224,204,0.65);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease, background 0.2s ease;
}
.nav a:hover, .nav a.active {
  background: rgba(222,219,200,0.08);
  color: #E1E0CC;
}
.nav a svg { width: 16px; height: 16px; opacity: 0.8; }

.user-card {
  margin-top: auto;
  background: rgba(222,219,200,0.06);
  border: 1px solid rgba(222,219,200,0.1);
  border-radius: 1rem;
  padding: 1rem;
}
.user-name { font-weight: 700; font-size: 0.95rem; color: #E1E0CC; }
.user-meta { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.15rem; }
.plan-badge {
  display: inline-flex;
  margin-top: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(222,219,200,0.12);
  color: var(--cream);
}

.main {
  flex: 1;
  padding: 1.75rem;
  overflow: auto;
}
@media (min-width: 768px) { .main { padding: 2.25rem; } }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.page-header h2 { font-size: 1.5rem; font-weight: 500; letter-spacing: -0.03em; }
.page-header p { color: var(--gray-500); font-size: 0.9rem; margin-top: 0.25rem; }

.grid { display: grid; gap: 1.25rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.panel {
  background: rgba(16, 16, 16, 0.72);
  border: 1px solid rgba(222, 219, 200, 0.1);
  border-radius: 1.25rem;
  padding: 1.25rem;
}
.panel h3 { font-size: 0.95rem; font-weight: 500; color: #E1E0CC; margin-bottom: 1rem; }
.panel h4 { font-size: 0.8rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.4rem; }

.stat-value { font-size: 1.75rem; font-weight: 700; color: #E1E0CC; letter-spacing: -0.02em; }
.stat-label { font-size: 0.75rem; color: var(--gray-500); }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.toolbar .grow { flex: 1; min-width: 140px; }

.repo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.repo-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(222,219,200,0.08);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
}
.repo-item .info { min-width: 0; }
.repo-item .name { font-weight: 600; color: #E1E0CC; }
.repo-item .desc { font-size: 0.75rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.repo-item .actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.empty-state {
  text-align: center;
  color: var(--gray-500);
  padding: 1.5rem 1rem;
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  padding: 0.85rem 1.1rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s, transform 0.3s;
  color: #000;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--cream); }
.toast.error { background: var(--red); color: #fff; }
.toast.info { background: var(--cream); }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  display: none; align-items: center; justify-content: center;
  z-index: 900;
}
.modal-backdrop.active { display: flex; }
.modal {
  background: rgba(16,16,16,0.95);
  border: 1px solid rgba(222,219,200,0.12);
  border-radius: 1.25rem;
  padding: 1.5rem;
  width: 90%; max-width: 420px;
}
.modal h3 { margin-bottom: 1rem; font-weight: 500; }
.modal .form-group:last-child { margin-bottom: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.25rem; }

.hint { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.35rem; }
.divider { height: 1px; background: rgba(222,219,200,0.1); margin: 1rem 0; }
