/* Hero Ad Container Styles - Matching Placeholder Design */
#hero-ad-container {
  display: block; /* Shown by default - will be hidden if no ad exists */
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  position: relative;
}

/* Hide container when no ad exists (for non-admins) */
#hero-ad-container:not(.has-ad):not(.is-admin):not(.banner-placeholder) {
  display: none;
}

/* Ad content wrapper - matches discover__advertisement */
.hero-ad-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

/* Ad article - matches placeholder exactly */
.hero-ad-content article,
.hero-ad-content .discover__advertisement {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  background: linear-gradient(135deg, rgba(45, 80, 22, 0.05) 0%, rgba(251, 191, 36, 0.05) 100%);
  border: 2px solid rgba(45, 80, 22, 0.1);
  border-radius: 16px;
  overflow: hidden;
  cursor: default;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 1rem;
}

.hero-ad-content article:hover,
.hero-ad-content .discover__advertisement:hover {
  border-color: #2d5016;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  transform: translateY(-4px);
}

.hero-ad-content .discover__advertisement-content {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
}

.hero-ad-content .discover__advertisement-text {
  flex: 1;
  min-width: 0;
}

.hero-ad-content .discover__advertisement-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.hero-ad-content .discover__advertisement-badge {
  background: #2d5016;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero-ad-content .discover__advertisement-advertiser {
  color: #666;
  font-size: 0.875rem;
}

.hero-ad-content .discover__advertisement-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.hero-ad-content .discover__advertisement-description {
  color: #666;
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.hero-ad-content .discover__advertisement-button {
  background: #2d5016;
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
  position: relative;
  z-index: 1;
  text-decoration: none;
}

.hero-ad-content .discover__advertisement-button i {
  transition: transform 0.3s ease;
}

.hero-ad-content article:hover .discover__advertisement-button,
.hero-ad-content .discover__advertisement:hover .discover__advertisement-button {
  background: #1a3d0b;
}

.hero-ad-content article:hover .discover__advertisement-button i,
.hero-ad-content .discover__advertisement:hover .discover__advertisement-button i {
  transform: translateX(4px);
}

/* Frame: fixed size; inner clip wrapper ensures zoomed image never sticks out */
.hero-ad-content .discover__advertisement-image {
  width: 400px;
  height: 200px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hero-ad-content .discover__advertisement-image__clip {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-ad-content .discover__advertisement-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  transition: transform 0.3s ease;
}

.hero-ad-content article:hover .discover__advertisement-image img,
.hero-ad-content .discover__advertisement:hover .discover__advertisement-image img {
  transform: scale(1.05);
}

/* Admin edit button */
.hero-ad-edit-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--color-primary, #2ecc71);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10;
  transition: background-color 0.2s;
}

.hero-ad-edit-btn:hover {
  background: var(--color-primary-dark, #27ae60);
}

.hero-ad-edit-btn i {
  font-size: 0.875rem;
}

/* Empty state */
.hero-ad-content--empty {
  color: var(--color-text-secondary, #666);
  font-style: italic;
  padding: 2rem;
  text-align: center;
  border: 2px dashed var(--color-border, #e0e0e0);
  border-radius: var(--radius-md, 8px);
}

/* Ad Editor Modal - extra transparent so live ad is clearly visible behind (layout unchanged) */
.ad-editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.ad-editor-modal-content {
  background: rgba(255, 255, 255, 0.70);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.ad-editor-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg, 1.5rem);
  border-bottom: 1px solid var(--color-border, #e0e0e0);
}

.ad-editor-modal-header h3 {
  margin: 0;
  font-size: var(--font-size-xl, 1.5rem);
}

.ad-editor-modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--color-text-secondary, #666);
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-editor-modal-close:hover {
  color: var(--color-text, #333);
}

/* Mode toggle bar */
.ad-editor-mode-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 1.25rem;
  background: #f9fafb;
}
.ad-editor-mode-btn {
  padding: 0.625rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.15s, border-color 0.15s;
}
.ad-editor-mode-btn:hover {
  color: #374151;
}
.ad-editor-mode-btn--active {
  color: #2d5016;
  border-bottom-color: #2d5016;
}

.ad-editor-modal-body {
  padding: var(--space-lg, 1.5rem);
}

.ad-editor-modal-footer {
  padding: var(--space-lg, 1.5rem);
  border-top: 1px solid var(--color-border, #e0e0e0);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.form-group {
  margin-bottom: var(--space-md, 1rem);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-xs, 0.5rem);
  font-weight: var(--font-weight-medium, 500);
}

.form-input {
  width: 100%;
  padding: var(--space-sm, 0.75rem);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: var(--radius-md, 8px);
  font-family: inherit;
  font-size: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary, #2ecc71);
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

/* Ad editor modal: sections, color swatches, position grid */
.ad-editor-modal .form-label { display: block; font-weight: 600; color: #374151; margin-bottom: 0.35rem; font-size: 0.8125rem; }
.ad-editor-modal .form-textarea { min-height: 72px; resize: vertical; }
.ad-editor-section { margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--color-border, #e5e7eb); }
.ad-editor-section:last-of-type { border-bottom: none; }
.ad-editor-section-title { font-size: 0.8125rem; font-weight: 700; color: #4b5563; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.ad-editor-section-bg { border: 1px solid rgba(107,33,168,0.15); border-radius: 10px; padding: 0.75rem; }
.ad-editor-color-swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; }
.ad-editor-color-swatch { width: 32px; height: 32px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; flex-shrink: 0; transition: border-color 0.2s, transform 0.2s; }
.ad-editor-color-swatch:hover { transform: scale(1.08); }
.ad-editor-color-swatch.selected { border-color: #2d5016; box-shadow: 0 0 0 2px #fff; }
.ad-editor-color-white { background: #fff !important; border: 1px solid #d1d5db !important; }
.ad-editor-color-picker-wrap { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ad-editor-color-picker-wrap .ad-editor-bg-input { width: 40px; height: 32px; padding: 2px; border-radius: 8px; cursor: pointer; }
/* Typography & colors section */
.ad-editor-section-typo { border: 2px solid rgba(45, 80, 22, 0.35); border-radius: 10px; padding: 0.75rem 1rem; background: rgba(45, 80, 22, 0.04); margin-bottom: 0.5rem; }
.ad-editor-section-typo .ad-editor-section-title { color: #1a3d0b; }
.ad-editor-typo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem 1rem; }
.ad-editor-typo-item { display: flex; flex-direction: column; gap: 0.25rem; }
.ad-editor-typo-item .form-label { font-size: 0.75rem; font-weight: 600; color: #4b5563; margin-bottom: 0; }
.ad-editor-typo-item .ad-editor-color-input { width: 100%; min-width: 0; height: 36px; padding: 2px; border-radius: 8px; cursor: pointer; border: 1px solid #e5e7eb; }
.ad-editor-position-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 140px; }
.ad-editor-position-wrap { margin: 0; cursor: pointer; display: block; }
.ad-editor-position-wrap input { position: absolute; opacity: 0; width: 0; height: 0; }
.ad-editor-position-btn { width: 40px; height: 40px; border: 2px solid #e5e7eb; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: #f9fafb; color: #4b5563; font-size: 1rem; transition: border-color 0.2s, background 0.2s; }
.ad-editor-position-wrap:hover .ad-editor-position-btn { border-color: #9ca3af; background: #f3f4f6; }
.ad-editor-position-wrap input:checked + .ad-editor-position-btn { border-color: #2d5016; background: rgba(45,80,22,0.08); color: #2d5016; }
.ad-editor-active-wrap { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; margin: 0; }
.ad-editor-active-cb { width: 18px; height: 18px; cursor: pointer; accent-color: #2d5016; }
.ad-editor-msg { margin-top: 0.5rem; font-size: 0.875rem; }
.ad-editor-error { color: #b91c1c; }
.ad-editor-success { color: #15803d; }
.ad-editor-modal-footer { display: flex; gap: 0.75rem; justify-content: flex-end; flex-wrap: wrap; }
.ad-editor-btn-cancel { padding: 0.5rem 1rem; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; font-weight: 500; }
.ad-editor-btn-cancel:hover { background: #f9fafb; }
.ad-editor-btn-save { padding: 0.5rem 1.25rem; border-radius: 8px; border: none; background: #2d5016; color: #fff; cursor: pointer; font-weight: 600; }
.ad-editor-btn-save:hover { background: #1a3d0b; }

/* Ad editor: image picker - file input inside label so click opens picker reliably */
.ad-editor-label-file { position: relative; display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; border: none; border-radius: 8px; font-weight: 600; font-size: 0.875rem; cursor: pointer; background: #16a34a; color: #fff; margin: 0; }
.ad-editor-label-file:hover { background: #15803d; }
.ad-editor-label-file .fa { font-size: 1rem; }
.ad-editor-label-file .ad-editor-image-file-input { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 100%; min-height: 100%; opacity: 0.001; cursor: pointer; font-size: 0; z-index: 1; }
.ad-editor-image-picker-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.ad-editor-btn-choose-image { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; border: none; border-radius: 8px; font-weight: 600; font-size: 0.875rem; cursor: pointer; background: #16a34a; color: #fff; margin: 0; }
.ad-editor-btn-choose-image:hover { background: #15803d; }
.ad-editor-btn-choose-image .fa { font-size: 1rem; }
.ad-editor-btn-upload-image { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; border: none; border-radius: 8px; font-weight: 600; font-size: 0.875rem; cursor: pointer; background: #2563eb; color: #fff; }
.ad-editor-btn-upload-image:hover { background: #1d4ed8; }
.ad-editor-btn-upload-image:disabled { opacity: 0.6; cursor: not-allowed; }
.ad-editor-btn-upload-image .fa { font-size: 1rem; }
.ad-editor-zoom-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; padding: 0.6rem 0.75rem; background: rgba(45, 80, 22, 0.06); border: 1px solid rgba(45, 80, 22, 0.2); border-radius: 8px; flex-wrap: wrap; }
.ad-editor-zoom-row .form-label { margin-bottom: 0; margin-right: 0.25rem; font-size: 0.8125rem; font-weight: 600; color: #1a3d0b; }
.ad-editor-zoom-btn { width: 36px; height: 36px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; color: #4b5563; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 0.95rem; transition: border-color 0.2s, background 0.2s; }
.ad-editor-zoom-btn:hover { border-color: #2d5016; background: rgba(45, 80, 22, 0.08); color: #2d5016; }
.ad-editor-zoom-value { font-size: 0.8125rem; font-weight: 600; color: #1a3d0b; min-width: 3rem; }

/* Responsive */
@media (max-width: 768px) {
  #hero-ad-container {
    padding: 1rem;
  }
  
  .hero-ad-content {
    flex-direction: column;
    min-height: 80px;
  }
  
  .hero-ad-edit-btn {
    position: static;
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
  }
  
  .ad-editor-modal-content {
    width: 95%;
    max-height: 95vh;
  }
}

