/* ==========================================================================
   LinkLeaders SaaS - Admin Dashboard & Live Editor Stylesheet
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #070a12;
  --surface-1: #0d121f;
  --surface-2: #141b2d;
  --surface-3: #1e2942;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(212, 175, 55, 0.3);
  
  --gold-500: #d4af37;
  --gold-400: #e5c07b;
  --gold-glow: rgba(212, 175, 55, 0.25);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ==========================================================================
   Top Navigation Bar
   ========================================================================== */

.top-navbar {
  height: 70px;
  background: rgba(13, 18, 31, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #d4af37 0%, #aa8420 100%);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 18px;
  box-shadow: 0 0 16px var(--gold-glow);
}

.brand-text-wrapper {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-name span {
  color: var(--gold-500);
}

.brand-tagline {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

.nav-center-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-select-wrapper {
  position: relative;
  min-width: 260px;
}

.page-select-dropdown {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-gold);
  color: #fff;
  padding: 10px 38px 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
}

.page-select-wrapper::after {
  content: '▼';
  font-size: 10px;
  color: var(--gold-500);
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.btn-new-page {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-400);
  border: 1px solid var(--border-gold);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-new-page:hover {
  background: var(--gold-500);
  color: #000;
  box-shadow: 0 0 16px var(--gold-glow);
}

.nav-right-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.public-slug-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 9999px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.public-slug-badge strong {
  color: var(--gold-400);
}

.btn-action-icon {
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-action-icon:hover {
  border-color: var(--gold-500);
  color: var(--gold-500);
}

/* ==========================================================================
   Main App Container (Split Screen: Left Editor / Right Phone Live Preview)
   ========================================================================== */

.app-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 480px;
  height: calc(100vh - 70px);
  overflow: hidden;
}

@media (max-width: 1100px) {
  .app-workspace {
    grid-template-columns: 1fr;
    height: auto;
  }
}

/* Left Editor Panel */
.editor-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-right: 1px solid var(--border-color);
  background: var(--bg-dark);
  overflow-y: auto;
}

.editor-header-tabs {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 16px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-btn svg {
  width: 18px;
  height: 18px;
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  color: var(--gold-400);
  border-bottom-color: var(--gold-500);
}

.tab-content-area {
  padding: 28px;
  max-width: 800px;
  width: 100%;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

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

/* ==========================================================================
   Editor Cards & Form Controls
   ========================================================================== */

.editor-card {
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.editor-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.card-title-group h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  color: #ffffff;
  margin-bottom: 4px;
}

.card-title-group p {
  font-size: 13px;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #fff;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: all 0.2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--gold-500);
  box-shadow: 0 0 12px var(--gold-glow);
  background: var(--surface-3);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Links List in Editor */
.links-manager-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.link-edit-card {
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  position: relative;
  transition: all 0.2s;
}

.link-edit-card:hover {
  border-color: rgba(212, 175, 55, 0.4);
}

.link-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.link-card-title-input {
  font-size: 15px;
  font-weight: 700;
  background: transparent;
  border: none;
  color: #fff;
  outline: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
  padding-bottom: 2px;
  width: 70%;
}

.link-card-title-input:focus {
  border-bottom-color: var(--gold-500);
}

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

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  border-radius: 24px;
  transition: .3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .3s;
}

input:checked + .toggle-slider {
  background-color: var(--accent-emerald);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.btn-icon-danger {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
}

.btn-icon-danger:hover {
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.1);
}

.btn-add-new-link {
  width: 100%;
  background: linear-gradient(135deg, var(--gold-500) 0%, #aa8420 100%);
  color: #000;
  font-weight: 700;
  font-size: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 16px var(--gold-glow);
}

.btn-add-new-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4);
}

/* Theme Selector Visual Cards */
.themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.theme-card-option {
  background: var(--surface-2);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.theme-card-option:hover {
  border-color: rgba(212, 175, 55, 0.5);
}

.theme-card-option.selected {
  border-color: var(--gold-500);
  background: rgba(212, 175, 55, 0.08);
  box-shadow: 0 0 16px var(--gold-glow);
}

.theme-preview-box {
  height: 70px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  position: relative;
  overflow: hidden;
}

.theme-mini-btn {
  width: 80%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.theme-card-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

/* LEAD.C Viral Growth Section */
.viral-strategy-banner {
  background: radial-gradient(circle at top right, rgba(212, 175, 55, 0.15) 0%, rgba(13, 18, 31, 0.95) 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
}

.viral-badge-preview-box {
  background: var(--surface-2);
  border: 1px dashed var(--border-gold);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
}

/* ==========================================================================
   Analytics Dashboard Cards
   ========================================================================== */

.metrics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 4px; height: 100%;
  background: var(--accent-color, var(--gold-500));
}

.kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.kpi-value {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: #ffffff;
}

.kpi-subtext {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Link Ranking Table */
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.ranking-table th {
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}

.ranking-table td {
  padding: 14px 12px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ranking-clicks-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 6px;
}

.ranking-clicks-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-500), var(--accent-emerald));
  border-radius: 9999px;
}

/* ==========================================================================
   Right Panel: Mobile Phone Simulator (Live Preview)
   ========================================================================== */

.preview-panel {
  background: var(--surface-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.preview-header-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.preview-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold-400);
  display: flex;
  align-items: center;
  gap: 6px;
}

.preview-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: liveBlink 1.5s infinite;
}

@keyframes liveBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* iPhone 15 Frame Mockup */
.phone-mockup-frame {
  width: 360px;
  height: 720px;
  background: #000;
  border: 10px solid #1f293d;
  border-radius: 46px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Dynamic Island */
.phone-dynamic-island {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 24px;
  background: #000;
  border-radius: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
}

.camera-lens {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0d121f;
  border: 1px solid #1e2942;
}

.phone-screen-viewport {
  width: 100%;
  height: 100%;
  background: #090d16;
  overflow-y: auto;
  position: relative;
}

.phone-screen-viewport iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.admin-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.admin-modal-card {
  background: var(--surface-1);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
}

.btn-primary-gold {
  background: linear-gradient(135deg, var(--gold-500) 0%, #aa8420 100%);
  color: #000;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-primary-gold:hover {
  box-shadow: 0 0 16px var(--gold-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
}
