/* ─────────────────────────────────────────────────────────
   DwellScript Design System
   ───────────────────────────────────────────────────────── */

:root {
  /* Navy — primary brand */
  --ds-navy-900: #0F1F3D;
  --ds-navy-800: #1A3A5C;
  --ds-navy-700: #1E4D7B;
  --ds-navy-600: #2563EB;
  --ds-navy-500: #3B82F6;
  --ds-navy-400: #60A5FA;
  --ds-navy-100: #DBEAFE;
  --ds-navy-50:  #EFF6FF;

  /* Venus Gold — accent / CTA (replaces orange) */
  --ds-gold-700: #A07830;
  --ds-gold-600: #C9A84C;
  --ds-gold-500: #D4B86A;
  --ds-gold-400: #E8CB7A;
  --ds-gold-50:  #FBF3DE;

  /* Neutrals */
  --ds-neutral-900: #111827;
  --ds-neutral-700: #374151;
  --ds-neutral-600: #4B5563;
  --ds-neutral-500: #6B7280;
  --ds-neutral-400: #9CA3AF;
  --ds-neutral-300: #D1D5DB;
  --ds-neutral-200: #E5E7EB;
  --ds-neutral-100: #F3F4F6;
  --ds-neutral-50:  #F9FAFB;

  /* Semantic */
  --ds-success-bg: #DCFCE7;
  --ds-success:    #16A34A;
  --ds-warning-bg: #FEF9C3;
  --ds-warning:    #CA8A04;
  --ds-error-bg:   #FEE2E2;
  --ds-error:      #DC2626;

  /* Page surfaces */
  --bg-page:      #F8F7F4;
  --bg-surface:   #FFFFFF;
  --bg-surface-2: #F3F4F6;
  --bg-sidebar:   #0F1F3D;
  --border:       #E5E7EB;
  --border-strong:#D1D5DB;

  /* Text */
  --text-primary:   #111827;
  --text-secondary: #4B5563;
  --text-tertiary:  #9CA3AF;

  /* Border radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-2xl:  28px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.12), 0 8px 10px -6px rgba(0,0,0,.05);
  --shadow-brand: 0 4px 14px rgba(37,99,235,.25);
  --shadow-gold:  0 4px 14px rgba(201,168,76,.28);

  /* Layout */
  --sidebar-width:  240px;
  --topbar-height:  64px;

  /* Transitions */
  --transition-base:   all .2s ease;
  --transition-spring: all .25s cubic-bezier(.34,1.56,.64,1);
}

/* Dark mode */
[data-theme="dark"] {
  --bg-page:      #0A0F1E;
  --bg-surface:   #111827;
  --bg-surface-2: #1F2937;
  --bg-sidebar:   #060D1A;
  --border:       #1F2937;
  --border-strong:#374151;
  --text-primary: #F9FAFB;
  --text-secondary:#9CA3AF;
  --text-tertiary: #6B7280;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.35), 0 2px 4px -2px rgba(0,0,0,.2);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.45), 0 4px 6px -4px rgba(0,0,0,.25);
}

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

/* ─── App Shell ───────────────────────────────────────── */
.ds-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─────────────────────────────────────────── */
.ds-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.ds-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
}

.ds-logo-link {
  display: inline-flex;
  align-items: center;
  padding: 0;
  text-decoration: none;
}

.ds-logo {
  height: 40px;
  width: auto;
  display: block;
}

.sidebar .ds-logo {
  height: 34px;
}

.ds-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--ds-gold-500), var(--ds-gold-600));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-gold);
}

.ds-logo-text {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.ds-logo-text span { color: var(--ds-gold-400); }

.ds-nav {
  padding: 12px 8px;
  flex: 1;
}

.ds-nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  padding: 12px 8px 4px;
}

.ds-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition-base);
  position: relative;
  margin-bottom: 2px;
}

.ds-nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
}

.ds-nav-item.active {
  color: #fff;
  background: rgba(255,255,255,.1);
}

.ds-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--ds-gold-500);
  border-radius: 0 2px 2px 0;
}

.ds-nav-item i {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar bottom section */
.ds-sidebar-bottom {
  padding: 12px 8px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.ds-quota-block {
  padding: 10px;
  margin-bottom: 8px;
}

.ds-quota-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255,255,255,.5);
  margin-bottom: 6px;
}

.ds-quota-bar {
  height: 4px;
  background: rgba(255,255,255,.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.ds-quota-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ds-navy-500), var(--ds-navy-400));
  border-radius: var(--radius-full);
  transition: width .4s ease;
}

.ds-quota-fill.warning { background: linear-gradient(90deg, var(--ds-gold-600), var(--ds-gold-500)); }

.ds-upgrade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 9px 12px;
  background: linear-gradient(135deg, var(--ds-gold-600), var(--ds-gold-500));
  color: #0F1F3D;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition-spring);
  box-shadow: var(--shadow-gold);
  margin-bottom: 8px;
}

.ds-upgrade-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(201,168,76,.35);
  color: #0F1F3D;
}

.ds-user-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-base);
}

.ds-user-row:hover { background: rgba(255,255,255,.08); }

.ds-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--ds-navy-600), var(--ds-navy-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.ds-user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255,255,255,.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* ─── Main Area ───────────────────────────────────────── */
.ds-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Topbar ──────────────────────────────────────────── */
.ds-topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.ds-topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

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

.ds-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-base);
  font-size: 15px;
  text-decoration: none;
}

.ds-icon-btn:hover {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

/* ─── Content Area ────────────────────────────────────── */
.ds-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ─── Cards ───────────────────────────────────────────── */
.ds-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

/* ─── Buttons ─────────────────────────────────────────── */
.btn-ds-primary {
  background: var(--ds-navy-800);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-spring);
  box-shadow: var(--shadow-brand);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
}

.btn-ds-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37,99,235,.3);
  color: #fff;
}

.btn-ds-accent {
  background: linear-gradient(135deg, var(--ds-gold-600), var(--ds-gold-500));
  color: #0F1F3D;
  border: none;
  border-radius: var(--radius-md);
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-spring);
  box-shadow: var(--shadow-gold);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
}

.btn-ds-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(201,168,76,.4);
  color: #0F1F3D;
}

.btn-ds-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
}

.btn-ds-ghost:hover {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border-color: var(--ds-navy-600);
}

/* ─── Status Pills ────────────────────────────────────── */
.ds-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
}

.ds-pill-active  { background: var(--ds-success-bg); color: var(--ds-success); }
.ds-pill-vacant  { background: var(--ds-warning-bg); color: var(--ds-warning); }
.ds-pill-archived{ background: var(--ds-neutral-100); color: var(--ds-neutral-500); }
.ds-pill-pro     { background: var(--ds-gold-50); color: var(--ds-gold-700); }
.ds-pill-starter { background: var(--ds-gold-50); color: var(--ds-gold-700); }
.ds-pill-free    { background: var(--ds-neutral-100); color: var(--ds-neutral-600); }

/* Platform tags */
.ds-tag-ltr     { background: var(--ds-navy-50); color: var(--ds-navy-700); border: 1px solid var(--ds-navy-100); padding: 2px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; }
.ds-tag-str     { background: var(--ds-gold-50); color: var(--ds-gold-700); border: 1px solid var(--ds-gold-50); padding: 2px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; }
.ds-tag-social  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; padding: 2px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; }

/* ─── Forms ───────────────────────────────────────────── */
.ds-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  transition: var(--transition-base);
  outline: none;
}

.ds-input:focus {
  border-color: var(--ds-navy-600);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.ds-input.error { border-color: var(--ds-error); }

.ds-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.ds-input-group {
  position: relative;
}

.ds-input-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 14px;
  pointer-events: none;
}

.ds-input-group .ds-input { padding-left: 34px; }

/* ─── Page Tabs ───────────────────────────────────────── */
.ds-page-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 0 24px;
}

.ds-tab {
  padding: 14px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition-base);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ds-tab:hover { color: var(--text-primary); }

.ds-tab.active {
  color: var(--ds-navy-600);
  border-bottom-color: var(--ds-navy-600);
  font-weight: 600;
}

.ds-tab .badge {
  background: var(--ds-neutral-200);
  color: var(--ds-neutral-600);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.ds-tab.active .badge { background: var(--ds-navy-100); color: var(--ds-navy-700); }

/* ─── Skeleton Shimmer ────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--ds-neutral-200) 25%, var(--ds-neutral-100) 50%, var(--ds-neutral-200) 75%);
  background-size: 200%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* ─── Floating/breathing animation ───────────────────── */
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes pop-in { 0% { transform: scale(0); opacity: 0; } 80% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }

/* ─── Copied Tooltip ──────────────────────────────────── */
#copiedTooltip {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ds-neutral-900);
  color: #fff;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}

#copiedTooltip.show { opacity: 1; }

/* ─── Divider ─────────────────────────────────────────── */
.ds-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ─── Empty State ─────────────────────────────────────── */
.ds-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-tertiary);
}

.ds-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: .4;
}

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .ds-sidebar { display: none; }
  .ds-content { padding: 16px; }

  /* Tab bar scrolls horizontally on narrow screens */
  .ds-page-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;        /* Firefox */
    padding: 0 12px;
  }
  .ds-page-tabs::-webkit-scrollbar { display: none; }  /* Chrome/Safari */

  .ds-tab {
    padding: 12px 10px;
    font-size: 12.5px;
    flex-shrink: 0;
  }
}
