/* ═══════════════════════════════════════════════════════════
   Ocuport Dashboard — Biostate Design System
   Fonts: Sora (headings) + Manrope (body/UI)
   Dark mode default, #0f172a background
   ═══════════════════════════════════════════════════════════ */

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

/* ── Tokens ── */
:root {
  --color-accent: #45d0bd;
  --color-accent-blue: #44b6e9;
  --color-accent-dark: #108080;
  --color-purple: #8258c8;
  --color-purple-alt: #6766c8;
  --color-blue: #2c84c8;
  --color-success: #0a875a;
  --color-warning: #f59e0b;
  --color-error: #dc2626;

  --g-primary: linear-gradient(90deg, #45d0bd, #44b6e9);
  --g-purple: linear-gradient(135deg, #8258c8, #2c84c8);
  --g-dark-card: linear-gradient(135deg, #A3F5FF 0%, #E987C4 100%);

  --font-heading: 'Sora', Arial, Helvetica, sans-serif;
  --font-body: 'Manrope', Arial, Helvetica, sans-serif;

  /* Dark mode (default) */
  --page-bg: #0f172a;
  --surface: #1e293b;
  --surface-elevated: #2c3338;
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.7);
  --text-muted: rgba(255,255,255,0.4);
  --border-subtle: rgba(255,255,255,0.07);
  --card-hover-shadow: 0 12px 32px rgba(0,0,0,0.3);

  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 15px;
  --r-xl: 16px;
  --r-2xl: 20px;
  --r-3xl: 25px;
  --r-pill: 9999px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-teal-glow: 0 4px 16px rgba(69,208,189,0.35);
}

/* ── Light mode overrides ── */
body.light-mode {
  --page-bg: #f9fafa;
  --surface: #ffffff;
  --surface-elevated: #f1f2f3;
  --text-primary: #111111;
  --text-secondary: #333333;
  --text-muted: #adadad;
  --border-subtle: rgba(0,0,0,0.07);
  --card-hover-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

/* ── Base ── */
body {
  font-family: var(--font-body);
  background: var(--page-bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

/* ── Header ── */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 72px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-logo {
  display: flex;
  align-items: center;
}

.dash-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Auth UI ── */
.dash-auth-area { display: flex; align-items: center; }
.dash-signin-btn {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 8px 16px; border-radius: var(--r-pill);
  background: var(--color-accent); color: #fff; border: none;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.dash-signin-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.dash-user-menu { position: relative; }
.dash-avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border-subtle);
  overflow: hidden; cursor: pointer; padding: 0; background: var(--surface);
}
.dash-avatar { width: 100%; height: 100%; object-fit: cover; display: block; }
.dash-user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); padding: 12px 16px; min-width: 200px;
  box-shadow: var(--shadow-lg); z-index: 100;
  display: flex; flex-direction: column; gap: 10px;
}
.dash-user-email { font-size: 12px; color: var(--text-secondary); word-break: break-all; }
.dash-signout-btn {
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: var(--r-sm);
  background: rgba(220,38,38,0.08); color: #dc2626; border: none;
  cursor: pointer; transition: all 0.2s;
}
.dash-signout-btn:hover { background: rgba(220,38,38,0.15); }

/* Cloud deck cards */
.deck-card .deck-shared-badge {
  position: absolute; top: 8px; left: 8px;
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: var(--r-pill);
  background: rgba(69,208,189,0.2); color: var(--color-accent);
}
.deck-card .deck-delete-btn {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(220,38,38,0.08); border: none;
  color: #dc2626; cursor: pointer; font-size: 12px;
  display: none; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.deck-card:hover .deck-delete-btn { display: flex; }
.deck-card .deck-delete-btn:hover { background: rgba(220,38,38,0.2); }
.deck-card .deck-updated {
  font-size: 10px; color: var(--text-muted); margin-top: 2px;
}

.dash-theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}
.dash-theme-btn:hover {
  background: rgba(69,208,189,0.1);
  color: var(--color-accent);
  border-color: rgba(69,208,189,0.3);
}

/* ── Main ── */
.dash-main {
  flex: 1;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 40px 80px;
}

/* ── Sections ── */
.dash-section {
  margin-bottom: 48px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: all 0.2s ease;
}
.section-close:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

/* ── Quick Actions ── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.quick-actions.quick-actions-4 {
  grid-template-columns: repeat(5, 1fr);
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 36px 20px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-2xl);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.action-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--g-primary);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
}
.action-card:hover::before {
  opacity: 1;
}

.action-icon {
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(69,208,189,0.1);
}

.action-label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

/* ── Integration Cards ── */
.integration-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.integration-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-2xl);
  transition: all 0.25s ease;
}

.integration-card[data-product="ocupath"],
.integration-card[data-product="ocuseq"] {
  cursor: pointer;
}

.integration-card[data-product="ocupath"]:hover,
.integration-card[data-product="ocuseq"]:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
}

.integ-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  flex-shrink: 0;
}
.ocupath-icon { background: rgba(69,208,189,0.12); color: var(--color-accent); }
.ocuseq-icon { background: rgba(130,88,200,0.12); color: var(--color-purple); }
.ocuflow-icon { background: rgba(44,132,200,0.12); color: var(--color-blue); opacity: 0.5; }

.integ-info { flex: 1; min-width: 0; }

.integ-name {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.integ-desc {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.integ-status { flex-shrink: 0; }

.integ-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  letter-spacing: 0.02em;
}
.integ-badge.scanning {
  background: rgba(69,208,189,0.1);
  color: var(--color-accent);
}
.integ-badge.ready {
  background: rgba(10,135,90,0.15);
  color: var(--color-success);
}
.integ-badge.none {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
}
.integ-badge.coming {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
}

body.light-mode .integ-badge.none,
body.light-mode .integ-badge.coming {
  background: rgba(0,0,0,0.04);
}
body.light-mode .integ-badge.scanning {
  background: rgba(69,208,189,0.08);
}

/* ── Deck Grid ── */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.deck-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.deck-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-2xl);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s ease;
}
.deck-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-hover-shadow);
}

.deck-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.deck-thumb-text {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
  line-height: 1.4;
}

.deck-thumb-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: var(--r-pill);
}
.deck-thumb-badge.json { background: rgba(69,208,189,0.2); color: var(--color-accent); }
.deck-thumb-badge.html { background: rgba(130,88,200,0.2); color: var(--color-purple); }

.deck-meta {
  padding: 14px 16px;
}

.deck-name {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deck-info {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Style Picker (visual deck themes, Keynote-style) ── */
.style-picker {
  animation: fadeSlideIn 0.3s ease;
}
.style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.style-card {
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.style-card:hover .style-preview {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.2);
}

.style-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  transition: all 0.25s ease;
  border: 1px solid var(--border-subtle);
}

/* Preview inner layout — mimics a title slide */
.style-preview-title {
  position: absolute;
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.style-preview-sub {
  position: absolute;
  font-family: var(--font-body);
  font-weight: 400;
  opacity: 0.7;
}
/* Decorative elements inside preview */
.style-preview-deco {
  position: absolute;
  border-radius: 3px;
  pointer-events: none;
}

.style-name {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

@media (max-width: 1024px) {
  .style-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .style-grid { grid-template-columns: 1fr; }
}

/* ── Template Grid ── */
.template-picker {
  animation: fadeSlideIn 0.3s ease;
}

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

.template-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-2xl);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}
.template-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--g-purple);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.template-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
}
.template-card:hover::before { opacity: 1; }

.template-name {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.template-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.template-slides {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-purple);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Animations ── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .quick-actions.quick-actions-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .dash-header { padding: 0 20px; }
  .dash-main { padding: 24px 20px 60px; }
  .quick-actions,
  .quick-actions.quick-actions-4 { grid-template-columns: 1fr; }
  .integration-cards { grid-template-columns: 1fr; }
  .deck-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
