/* =============================================================
   OdyZee Web Management — Admin Styles
   Shares the brand tokens of the landing page.
   ============================================================= */

/* ---------- 1. Design tokens ---------- */
:root {
  --bg: #0B1120;
  --bg-alt: #0F172A;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --text: #FFFFFF;
  --text-muted: #94A3B8;
  --danger: #F87171;
  --success: #34D399;

  --teal: #14B8A6;
  --cyan: #22D3EE;
  --violet: #8B5CF6;
  --gradient: linear-gradient(135deg, var(--teal) 0%, var(--violet) 100%);

  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- 2. Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:disabled { opacity: 0.35; cursor: not-allowed; }
code { font-size: 0.85em; padding: 2px 6px; border-radius: 6px; background: var(--surface-hover); }

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--text-muted); }

.logo { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
.logo small { font-size: 0.7rem; font-weight: 500; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; margin-left: 4px; }
.z { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- 3. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 8px 30px -10px rgba(139, 92, 246, 0.6); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); }
.btn-ghost { border: 1px solid var(--border); color: var(--text-muted); }
.btn-ghost:hover { border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.btn-block { width: 100%; padding: 13px 20px; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover:not(:disabled) { background: var(--surface-hover); color: #fff; }
.icon-btn.danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.12); color: var(--danger); }

.link-btn { margin-top: 8px; font-size: 0.85rem; color: var(--danger); }
.link-btn:hover { text-decoration: underline; }

/* ---------- 4. Forms ---------- */
.field { margin-bottom: 18px; flex: 1; min-width: 0; }
.field label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; }
.field small { display: block; margin-top: 4px; font-size: 0.75rem; }

.field input,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  font-size: 0.9rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field input::placeholder,
.field textarea::placeholder { color: #64748B; }

.field input:focus,
.field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2); }

.field-row { display: flex; flex-direction: column; gap: 0 16px; }

.form-error { min-height: 1.2em; font-size: 0.85rem; color: var(--danger); margin-bottom: 8px; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  transition: background var(--transition);
}
.switch span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
}
.switch input:checked + span { background: var(--gradient); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.35); }

.switch-row { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; margin-bottom: 12px; cursor: pointer; }

/* ---------- 5. Setup & login ---------- */
.center-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 10% 10%, rgba(20, 184, 166, 0.18), transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(139, 92, 246, 0.18), transparent 40%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 36px 28px;
  border-radius: 20px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
}

.auth-card .logo { margin-bottom: 28px; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-card > p { margin-bottom: 24px; font-size: 0.9rem; }
.auth-card > p + p { margin-top: -12px; }

/* ---------- 6. App shell ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-actions .btn { padding: 8px 14px; font-size: 0.8rem; }
.user-email { display: none; font-size: 0.85rem; color: var(--text-muted); }
#view-site-link { display: none; }

.main { padding-top: 32px; padding-bottom: 64px; }

.page-head { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 1.6rem; line-height: 1.2; margin-bottom: 4px; }
.page-head p { font-size: 0.9rem; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-row li {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.stat-row span { display: block; font-size: 1.4rem; font-weight: 700; color: #fff; }

.loading { text-align: center; padding: 40px 0; }

/* ---------- 7. Project list ---------- */
.project-list { display: grid; gap: 12px; }

.project-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color var(--transition), background var(--transition);
}

.project-row:hover { background: var(--surface-hover); border-color: rgba(139, 92, 246, 0.35); }
.project-row.is-hidden .row-thumb,
.project-row.is-hidden .row-info { opacity: 0.5; }

.row-thumb {
  width: 88px;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 30%, rgba(34, 211, 238, 0.5), transparent 55%),
    linear-gradient(135deg, #312E81, #134E4A);
}

.row-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }

.row-info { min-width: 0; }
.row-info h3 { font-size: 0.98rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  margin-right: 6px;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
}

.row-controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.row-status { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--text-muted); }
.row-actions { display: flex; gap: 2px; }

.empty-state {
  text-align: center;
  padding: 56px 24px;
  border-radius: var(--radius);
  border: 1px dashed rgba(255, 255, 255, 0.15);
}
.empty-state h2 { font-size: 1.2rem; margin-bottom: 4px; }
.empty-state p { margin-bottom: 20px; }

/* ---------- 8. Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 6, 15, 0.7); backdrop-filter: blur(4px); }

.modal-card {
  position: relative;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  animation: slide-up 0.3s ease;
}

@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } }

.modal-head,
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 16px 20px; }
.modal-head { justify-content: space-between; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 1.15rem; }
.modal-foot { justify-content: flex-end; border-top: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; }

body.modal-open { overflow: hidden; }

/* Image dropzone */
.dropzone {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 220px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover { border-color: var(--teal); background: rgba(20, 184, 166, 0.06); }

.dropzone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; }

.dropzone-hint { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 12px; color: var(--text-muted); font-size: 0.85rem; }
.dropzone-hint svg { width: 28px; height: 28px; margin-bottom: 4px; color: var(--cyan); }
.dropzone-hint small { font-size: 0.72rem; }

/* ---------- 9. Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  background: #1E293B;
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: opacity var(--transition), transform var(--transition);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { border-color: rgba(52, 211, 153, 0.4); }
.toast.error { border-color: rgba(248, 113, 113, 0.5); color: #FCA5A5; }

/* ---------- 10. Responsive: tablet & up ---------- */
@media (min-width: 640px) {
  .container { padding: 0 24px; }
  #view-site-link { display: inline-flex; }

  .page-head { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .field-row { flex-direction: row; }

  .project-row { grid-template-columns: 128px 1fr auto; gap: 18px; padding: 14px; }
  .row-thumb { width: 128px; }
  .row-controls { grid-column: auto; padding-top: 0; border-top: none; gap: 16px; }

  .modal { align-items: center; padding: 24px; }
  .modal-card { max-width: 620px; border-radius: 20px; }
}

@media (min-width: 900px) {
  .user-email { display: inline; }
}
