/* ==========================================================================
   Sawt Ad Server — Publisher Mockup Styles
   Dark theme: background #0d1117, text #c9d1d9, accent #58a6ff
   ========================================================================== */

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

body {
  background: #0d1117;
  color: #c9d1d9;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: #58a6ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Publisher Header
   ========================================================================== */

.publisher-header {
  background: #161b22;
  border-bottom: 1px solid #21262d;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 12px;
}

.header-brand {
  display: flex;
  flex-direction: column;
}

.site-title {
  font-size: 26px;
  font-weight: 700;
  color: #f0f6fc;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.title-accent {
  color: #58a6ff;
}

.site-tagline {
  font-size: 12px;
  color: #8b949e;
  margin-top: 2px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tenant-label {
  font-size: 11px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.tenant-select {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #c9d1d9;
  font-size: 13px;
  padding: 6px 12px;
  cursor: pointer;
}

.tenant-select:focus {
  border-color: #58a6ff;
  outline: none;
}

.header-nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 4px;
  padding-bottom: 0;
  border-top: 1px solid #21262d;
  padding-top: 8px;
  padding-bottom: 8px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: #8b949e;
  padding: 6px 14px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
  color: #f0f6fc;
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

.nav-link.active {
  color: #f0f6fc;
  background: #21262d;
}

/* ==========================================================================
   Ad Zones — Base
   ========================================================================== */

.ad-zone {
  background: #161b22;
  border: 1px dashed #30363d;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s;
}

.ad-zone.is-filled {
  border-style: solid;
  border-color: #21262d;
}

.ad-zone.is-empty {
  border-style: dashed;
  border-color: #21262d;
}

.ad-zone.is-error {
  border-color: #f8514930;
}

.ad-zone.is-loading {
  border-color: #30363d;
}

.ad-zone-inner {
  position: relative;
}

.ad-zone-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #484f58;
  padding: 6px 12px 4px;
  font-weight: 500;
}

.ad-zone-content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: 8px 12px 12px;
}

.ad-placeholder,
.ad-nofill,
.ad-error,
.ad-fallback {
  font-size: 13px;
  font-style: italic;
  text-align: center;
}

.ad-placeholder {
  color: #484f58;
}

.ad-nofill {
  color: #484f58;
}

.ad-error {
  color: #f85149;
}

.ad-fallback {
  color: #8b949e;
}

/* Creative wrapper */
.ad-creative-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-creative-wrapper:hover {
  opacity: 0.92;
}

.ad-image {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Loading animation */
.ad-loading {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}

.ad-loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #30363d;
  animation: ad-pulse 1.2s ease-in-out infinite;
}

.ad-loading-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.ad-loading-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ad-pulse {
  0%, 80%, 100% {
    background: #30363d;
    transform: scale(1);
  }
  40% {
    background: #58a6ff;
    transform: scale(1.3);
  }
}

/* ==========================================================================
   Ad Zone — Leaderboard (728x90)
   ========================================================================== */

.leaderboard {
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 24px;
}

.leaderboard .ad-zone-content {
  min-height: 90px;
  max-height: 110px;
}

/* ==========================================================================
   Ad Zone — Sidebar (300x250)
   ========================================================================== */

.sidebar-ad .ad-zone-content {
  min-height: 250px;
}

/* ==========================================================================
   Ad Zone — Native Ads
   ========================================================================== */

.native-ad .ad-zone-content {
  min-height: 80px;
}

.native-ad.in-feed {
  margin: 24px 0;
}

.native-ad.sponsored-product .ad-zone-content {
  min-height: 120px;
}

/* ==========================================================================
   Publisher Layout — Main + Sidebar
   ========================================================================== */

.publisher-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
}

.content-main {
  min-width: 0; /* Prevent grid blowout */
}

.content-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 100px;
}

/* ==========================================================================
   Article Styles
   ========================================================================== */

.article {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
}

.article.featured {
  border-color: #30363d;
}

.article-category {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.1);
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.article-title {
  font-size: 22px;
  font-weight: 600;
  color: #f0f6fc;
  line-height: 1.3;
  margin-bottom: 10px;
}

.article:not(.featured) .article-title {
  font-size: 18px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: #8b949e;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #21262d;
}

.article-author {
  font-weight: 500;
}

.article-excerpt {
  font-size: 15px;
  line-height: 1.7;
  color: #c9d1d9;
  margin-bottom: 12px;
}

.article-body {
  font-size: 14px;
  line-height: 1.7;
  color: #8b949e;
  margin-bottom: 12px;
}

.article-body:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Sidebar Sections
   ========================================================================== */

.sidebar-section {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 20px;
}

.sidebar-heading {
  font-size: 14px;
  font-weight: 600;
  color: #f0f6fc;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Trending list */
.trending-list {
  list-style: none;
}

.trending-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #21262d;
  font-size: 13px;
  color: #c9d1d9;
  line-height: 1.4;
}

.trending-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.trending-item:first-child {
  padding-top: 0;
}

.trending-rank {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #21262d;
  color: #8b949e;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
}

.trending-text {
  flex: 1;
}

/* Newsletter */
.newsletter-text {
  font-size: 13px;
  color: #8b949e;
  margin-bottom: 12px;
  line-height: 1.5;
}

.newsletter-form {
  display: flex;
  gap: 8px;
}

.newsletter-input {
  flex: 1;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #c9d1d9;
  font-size: 13px;
  padding: 8px 12px;
}

.newsletter-input:focus {
  border-color: #58a6ff;
  outline: none;
}

.newsletter-btn {
  background: #238636;
  border: 1px solid rgba(240, 246, 252, 0.1);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  white-space: nowrap;
}

.newsletter-btn:hover {
  background: #2ea043;
}

.newsletter-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ==========================================================================
   Publisher Footer
   ========================================================================== */

.publisher-footer {
  background: #161b22;
  border-top: 1px solid #21262d;
  margin-top: 40px;
  padding: 24px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-logo {
  font-size: 16px;
  font-weight: 600;
  color: #f0f6fc;
}

.footer-copy {
  font-size: 12px;
  color: #484f58;
}

.footer-copy strong {
  color: #58a6ff;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-link {
  font-size: 13px;
  color: #8b949e;
  transition: color 0.15s;
}

.footer-link:hover {
  color: #58a6ff;
  text-decoration: none;
}

.footer-sep {
  color: #30363d;
  font-size: 12px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 960px) {
  .publisher-layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .content-sidebar {
    position: static;
  }

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

  .header-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .leaderboard {
    padding: 0 12px;
  }

  .publisher-layout {
    padding: 12px;
    gap: 16px;
  }

  .article {
    padding: 16px;
  }

  .article-title {
    font-size: 18px;
  }

  .article:not(.featured) .article-title {
    font-size: 16px;
  }

  .article-meta {
    gap: 8px;
  }
}

/* ==========================================================================
   Debug Console Styles (preserved for debug.html)
   ========================================================================== */

.config-panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-field label {
  color: #8b949e;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.config-field select,
.config-field input {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #c9d1d9;
  font-size: 14px;
  padding: 8px 12px;
}

.config-field select:focus,
.config-field input:focus {
  border-color: #58a6ff;
  outline: none;
}

#load-ads-btn {
  background: #238636;
  border: 1px solid rgba(240, 246, 252, 0.1);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 24px;
}

#load-ads-btn:hover {
  background: #2ea043;
}

#load-ads-btn:active {
  background: #238636;
}

/* Ad zones (debug page legacy layout) */
.ad-zones {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.zone-header {
  background: #21262d;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #30363d;
}

.zone-label {
  font-size: 13px;
  font-weight: 600;
  color: #f0f6fc;
}

.zone-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #30363d;
  color: #8b949e;
}

.zone-status.loading {
  background: #1f1d2e;
  color: #d2a8ff;
}

.zone-status.success {
  background: #0d2818;
  color: #3fb950;
}

.zone-status.error {
  background: #2d1216;
  color: #f85149;
}

.zone-content {
  padding: 16px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder {
  color: #484f58;
  font-size: 13px;
  font-style: italic;
}

.zone-error {
  color: #f85149;
  font-size: 13px;
  word-break: break-word;
}

/* Debug panel */
.debug-panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 20px;
  position: relative;
}

.debug-panel .clear-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #8b949e;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 12px;
}

.debug-panel .clear-btn:hover {
  color: #c9d1d9;
  border-color: #8b949e;
}

#debug-log {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.debug-entry {
  padding: 8px 0;
  border-bottom: 1px solid #21262d;
}

.debug-entry:last-child {
  border-bottom: none;
}

.debug-timestamp {
  color: #484f58;
}

.debug-source {
  font-weight: 600;
}

.debug-source.kevel { color: #58a6ff; }
.debug-source.direct { color: #3fb950; }
.debug-source.prebid { color: #d2a8ff; }
.debug-source.error { color: #f85149; }

h1 {
  color: #f0f6fc;
  font-size: 24px;
  font-weight: 600;
}

.subtitle {
  color: #8b949e;
  font-size: 14px;
  margin-top: 4px;
}

h2 {
  color: #f0f6fc;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

@media (max-width: 900px) {
  .ad-zones {
    grid-template-columns: 1fr;
  }
  .config-grid {
    grid-template-columns: 1fr;
  }
}
