/* Flanked Dashboard Styles - matches landing page design language */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-hover: #1c1c28;
  --text-primary: #e8e8ed;
  --text-secondary: #8888a0;
  --text-muted: #555570;
  --accent: #ff3d3d;
  --accent-dim: rgba(255, 61, 61, 0.12);
  --accent-glow: rgba(255, 61, 61, 0.25);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.12);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.12);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.12);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.12);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4, h5 { font-family: 'Space Grotesk', sans-serif; }

/* Grid background */
.grid-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ============ LAYOUT ============ */

.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  cursor: pointer;
}

.sidebar-logo span { color: var(--accent); }

.sidebar-nav { flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-item .nav-icon { font-size: 18px; width: 24px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.user-info:hover { background: var(--bg-hover); }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.user-email {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 32px 40px;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.page-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.page-header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============ CARDS ============ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--border-hover); }

.stat-card .stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
}

.stat-card .stat-icon {
  font-size: 20px;
  margin-bottom: 8px;
}

/* ============ BUTTONS ============ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #e63535;
  border-color: #e63535;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-hover);
}

.btn-danger {
  color: var(--red);
}

.btn-danger:hover {
  background: var(--red-dim);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============ FORMS ============ */

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

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

.form-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder {
  color: var(--text-muted);
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238888a0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

/* ============ TABLES & LISTS ============ */

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.card-body { padding: 0; }
.card-body.padded { padding: 24px; }

.list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  cursor: pointer;
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg-hover); }

.list-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.list-content { flex: 1; min-width: 0; }

.list-content h4 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-content p {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-meta {
  text-align: right;
  flex-shrink: 0;
}

.list-meta .time {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Severity badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-critical { background: var(--red-dim); color: var(--red); }
.badge-high { background: var(--amber-dim); color: var(--amber); }
.badge-medium { background: var(--blue-dim); color: var(--blue); }
.badge-low { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }

/* Change type icons */
.type-pricing { background: var(--amber-dim); }
.type-feature { background: var(--green-dim); }
.type-content { background: var(--blue-dim); }
.type-hiring { background: var(--purple-dim); }
.type-launch { background: var(--accent-dim); }
.type-default { background: rgba(255,255,255,0.06); }

/* ============ MODAL ============ */

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ============ EMPTY STATE ============ */

.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto 24px;
}

/* ============ LOADING ============ */

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400px;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ============ AUTH PAGE ============ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 400px;
  max-width: 90vw;
}

.auth-card .auth-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.auth-card .auth-logo span { color: var(--accent); }

.auth-card .auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

.auth-card .auth-toggle {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 20px;
}

.auth-card .auth-toggle a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.auth-card .auth-toggle a:hover { text-decoration: underline; }

.auth-error {
  background: var(--red-dim);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.auth-error.visible { display: block; }

/* ============ FEED ============ */

.feed-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.filter-chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--accent-dim);
  border-color: rgba(255, 61, 61, 0.3);
  color: var(--accent);
}

/* ============ CHANGE DETAIL ============ */

.change-detail {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.change-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.change-detail h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.change-detail .change-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.analysis-block {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
}

.analysis-block h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 10px;
}

.analysis-block p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}

/* ============ DIGEST ============ */

.digest-content {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  font-size: 14px;
  line-height: 1.8;
}

.digest-content h1, .digest-content h2, .digest-content h3 {
  margin: 20px 0 8px;
}

.digest-content h1 { font-size: 22px; }
.digest-content h2 { font-size: 18px; }
.digest-content h3 { font-size: 16px; }

.digest-content ul, .digest-content ol {
  padding-left: 24px;
  margin: 8px 0;
}

.digest-content li { margin: 4px 0; }

.digest-content strong { color: var(--accent); }

/* ============ COMPETITOR CARD ============ */

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

.competitor-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: border-color 0.2s;
}

.competitor-card:hover { border-color: var(--border-hover); }

.competitor-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.competitor-card-header h4 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.competitor-url {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.competitor-url a {
  color: var(--text-secondary);
  text-decoration: none;
}

.competitor-url a:hover { color: var(--accent); }

.competitor-stats {
  display: flex;
  gap: 20px;
}

.competitor-stat {
  text-align: center;
}

.competitor-stat .num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  display: block;
}

.competitor-stat .label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.competitor-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ============ TOAST ============ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideIn 0.2s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--blue); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============ RESPONSIVE ============ */

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .competitor-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    width: 95vw;
  }

  .page-header-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* Mobile nav toggle */
.mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  z-index: 10;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 768px) {
  .mobile-nav { display: flex; }
  .main-content { padding-top: 72px; }
}

.mobile-nav .logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.mobile-nav .logo span { color: var(--accent); }

/* ============ BACK BUTTON ============ */

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 16px;
  padding: 4px 0;
}

.back-btn:hover { color: var(--text-primary); }

/* ============ TWO COLUMN LAYOUT ============ */

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ============ PULSE ANIMATION ============ */

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  animation: pulse 2s infinite;
}

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