/* ============================================================
   SEOnHOTnPORN - Dashboard Layout
   Luxury Gold/Black/Red Theme
   ============================================================ */

/* === Main App Layout === */
#main-screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
}

#main-screen.active {
  display: flex;
}

/* === Mobile Header === */
#mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--black-rich);
  border-bottom: 1px solid var(--border-gold);
  z-index: var(--z-header);
  align-items: center;
  padding: 0 0.75rem;
  gap: 0.75rem;
}

#mobile-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-muted), transparent);
  opacity: 0.4;
}

#mobile-header h2 {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gold);
  font-family: 'Playfair Display', serif;
}

#header-actions {
  display: flex;
  gap: 0.25rem;
}

/* === Sidebar === */
#sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--black-rich);
  border-right: 1px solid var(--border);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal);
  overflow-y: auto;
  overflow-x: hidden;
}

#sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, var(--gold-muted), transparent 30%, transparent 70%, var(--gold-muted));
  opacity: 0.3;
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1rem;
  border-bottom: 1px solid var(--border);
  min-height: var(--header-height);
  position: relative;
}

.sidebar-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-muted), transparent);
  opacity: 0.3;
}

/* Sidebar brand logo */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  min-width: 0;
}

.sidebar-brand .brand-seo {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 1rem;
  color: var(--gold);
  line-height: 1;
}

.sidebar-brand .brand-n {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.7rem;
  color: #555;
  line-height: 1;
}

.sidebar-brand .brand-hot {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 1rem;
  color: var(--red-hot);
  line-height: 1;
}

.sidebar-brand .brand-porn {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 1rem;
  color: var(--gold);
  line-height: 1;
}

.sidebar-title {
  font-weight: 700;
  font-size: 1.125rem;
  flex: 1;
  color: var(--gold);
  font-family: 'Playfair Display', serif;
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--gold-muted);
  padding: 0.75rem 0.875rem 0.25rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  margin-bottom: 2px;
  text-decoration: none;
  position: relative;
}

.nav-item:hover {
  background: var(--gold-glow);
  color: var(--gold);
}

.nav-item.active {
  background: var(--gold-glow);
  color: var(--gold);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  border-radius: 0 2px 2px 0;
}

.nav-item svg {
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.sidebar-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-muted), transparent);
  opacity: 0.3;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(212, 168, 67, 0.3);
}

.user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-details span:first-child {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === Sidebar Overlay === */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: calc(var(--z-sidebar) - 1);
  backdrop-filter: blur(4px);
}

/* === Content Area === */
#content-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  background: var(--bg-primary);
}

/* === Dashboard Home === */
.dashboard-home .stat-grid {
  margin-bottom: 1.25rem;
}

.dashboard-home .dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Mini chart bars - gold themed */
.mini-chart {
  height: 120px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding-top: 1rem;
}

.mini-chart .bar {
  flex: 1;
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  border-radius: 2px 2px 0 0;
  min-height: 4px;
  transition: height var(--transition-normal), opacity var(--transition-fast);
  opacity: 0.6;
}

.mini-chart .bar:hover {
  opacity: 1;
  box-shadow: 0 0 8px rgba(212, 168, 67, 0.4);
}

/* Revenue bar variant */
.mini-chart .bar.revenue {
  background: linear-gradient(180deg, var(--green), #1a9b50);
}

.mini-chart .bar.clicks {
  background: linear-gradient(180deg, var(--red-hot), var(--red));
}

/* Site list in dashboard */
.site-list-mini {
  list-style: none;
}

.site-list-mini li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  transition: background var(--transition-fast);
}

.site-list-mini li:hover {
  background: var(--gold-glow);
  margin: 0 -0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius-sm);
}

.site-list-mini li:last-child {
  border-bottom: none;
}

.site-list-mini .site-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.site-list-mini .site-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 4px currentColor;
}

.status-dot.healthy { background: var(--green); color: var(--green); }
.status-dot.degraded { background: var(--yellow); color: var(--yellow); }
.status-dot.down { background: var(--red-hot); color: var(--red-hot); animation: pulse-dot 2s ease infinite; }
.status-dot.unknown { background: var(--text-muted); color: var(--text-muted); }
.status-dot.draft { background: var(--text-muted); color: var(--text-muted); }
.status-dot.live { background: var(--green); color: var(--green); }
.status-dot.paused { background: var(--yellow); color: var(--yellow); }
.status-dot.error { background: var(--red-hot); color: var(--red-hot); animation: pulse-dot 2s ease infinite; }
.status-dot.building { background: var(--gold); color: var(--gold); animation: pulse-dot 1.5s ease infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Activity feed */
.activity-feed {
  list-style: none;
}

.activity-feed li {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}

.activity-feed li:last-child { border-bottom: none; }

.activity-time {
  color: var(--gold-muted);
  font-size: 0.75rem;
  white-space: nowrap;
  min-width: 50px;
}

/* Issues list */
.issue-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  transition: background var(--transition-fast);
}

.issue-item:hover {
  background: var(--gold-glow);
  margin: 0 -0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--border-radius-sm);
}

.issue-item:last-child { border-bottom: none; }

.issue-severity {
  width: 6px;
  height: 24px;
  border-radius: 3px;
  flex-shrink: 0;
}

.issue-severity.critical { background: linear-gradient(180deg, var(--red-hot), var(--red)); box-shadow: 0 0 8px var(--red-glow); }
.issue-severity.warning { background: linear-gradient(180deg, var(--yellow), var(--orange)); }
.issue-severity.info { background: linear-gradient(180deg, var(--gold-light), var(--gold)); }

/* === Section-specific styles === */

/* Sites grid */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.site-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.site-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-dark));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.site-card:hover {
  border-color: var(--gold-muted);
  box-shadow: var(--shadow-gold);
  transform: translateY(-2px);
}

.site-card:hover::before {
  opacity: 1;
}

.site-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.site-card-type {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-muted);
  font-weight: 600;
}

.site-card-name {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.site-card-domain {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-card-stats {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.site-card-stat {
  display: flex;
  flex-direction: column;
}

.site-card-stat .label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.site-card-stat .value {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--gold);
}

/* Model cards */
.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.model-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.model-card:hover {
  border-color: var(--red-hot);
  transform: translateY(-3px);
  box-shadow: var(--shadow-red), 0 0 20px rgba(255, 45, 85, 0.1);
}

.model-card-img {
  width: 100%;
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, var(--black-card), var(--black-elevated));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
}

.model-card-img::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  pointer-events: none;
}

.model-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.model-card-info {
  padding: 0.75rem;
}

.model-card-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.model-card-category {
  font-size: 0.75rem;
  color: var(--gold-muted);
}

/* Affiliate table enhancements */
.revenue-positive { color: var(--green); font-weight: 600; }
.conversion-rate { font-weight: 600; color: var(--gold); }

/* Analytics charts placeholder */
.chart-placeholder {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
}

.chart-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 39px,
    var(--border) 39px,
    var(--border) 40px
  );
  opacity: 0.3;
}

/* === Responsive - Tablet === */
@media (max-width: 1024px) {
  .dashboard-home .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* === Responsive - Mobile === */
@media (max-width: 768px) {
  #mobile-header {
    display: flex;
  }

  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  #sidebar.open ~ #sidebar-overlay {
    display: block;
  }

  #content-area {
    margin-left: 0;
    padding-top: var(--header-height);
  }

  .section-page {
    padding: 1rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .stat-card .stat-value {
    font-size: 1.25rem;
  }

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

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

  .table-container {
    font-size: 0.75rem;
  }

  th, td {
    padding: 0.5rem 0.75rem;
  }

  #toast-container {
    left: 1rem;
    right: 1rem;
  }

  .toast {
    max-width: none;
  }
}

/* === Responsive - Small Mobile === */
@media (max-width: 380px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .stat-card {
    padding: 0.75rem;
  }

  .model-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
}
