/* Styling for Custom Editorial Power Rankings & Ranker Admin */

.power-rankings-header-bar {
  max-width: var(--content-max-width);
  margin: 0 auto 20px auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-action-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.admin-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.admin-badge-active {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Editorial Overview Card */
.editorial-overview-card {
  max-width: var(--content-max-width);
  margin: 0 auto 24px auto;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--accent-color, #38bdf8);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.editorial-overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.editorial-headline {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.editorial-author-tag {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 4px;
}

.editorial-summary-text {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.5;
  margin: 0;
}

/* Rankings Section & Cards Stack (1 to 10) */
#editorial-view-section {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  box-sizing: border-box;
  overflow-x: hidden;
}

.editorial-rankings-stack {
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  box-sizing: border-box;
}

.rank-card {
  background: var(--card-bg, #1e293b);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.rank-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.rank-card.is-my-team {
  border-color: var(--highlight-border, #2dd4bf);
  background: rgba(13, 148, 136, 0.08);
}

/* Podium Rank Accents */
.rank-card.rank-gold {
  border-color: rgba(251, 191, 36, 0.4);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.05) 0%, var(--card-bg) 60%);
}

.rank-card.rank-silver {
  border-color: rgba(226, 232, 240, 0.4);
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.04) 0%, var(--card-bg) 60%);
}

.rank-card.rank-bronze {
  border-color: rgba(217, 119, 6, 0.4);
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.05) 0%, var(--card-bg) 60%);
}

.rank-badge-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding-top: 4px;
}

.rank-num-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 900;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  line-height: 1;
}

.rank-gold .rank-num-badge {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #1e1b4b;
  border: none;
  box-shadow: 0 2px 10px rgba(251, 191, 36, 0.4);
}

.rank-silver .rank-num-badge {
  background: linear-gradient(135deg, #f1f5f9 0%, #94a3b8 100%);
  color: #0f172a;
  border: none;
  box-shadow: 0 2px 10px rgba(226, 232, 240, 0.3);
}

.rank-bronze .rank-num-badge {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #fff;
  border: none;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.3);
}

.rank-movement-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.movement-up {
  color: #34d399;
  background: rgba(52, 211, 153, 0.15);
}

.movement-down {
  color: #fb7185;
  background: rgba(251, 113, 133, 0.15);
}

.movement-same {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
}

.movement-new {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

.rank-card-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.rank-team-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.rank-team-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.rank-team-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.rank-team-owner {
  font-size: 0.85rem;
  color: var(--accent-color, #38bdf8);
  font-weight: 700;
}

.rank-stats-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.stat-pill strong {
  color: #fff;
}

.stat-pill.power-index-pill {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fbbf24;
}

.stat-pill.power-index-pill strong {
  color: #fef08a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0.02em;
}

.rank-blurb-box {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px 14px;
  position: relative;
  word-break: break-word;
  overflow-wrap: break-word;
}

.rank-blurb-text {
  font-size: 0.88rem;
  color: #e2e8f0;
  line-height: 1.5;
  margin: 0;
  font-style: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.is-hidden {
  display: none;
}

.modal-card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
}

.modal-card.modal-card-wide {
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #fff;
}

/* Admin Login Form */
.admin-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.admin-form-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.admin-input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  color: #fff;
  outline: none;
  transition: border-color 0.2s ease;
}

.admin-input:focus {
  border-color: var(--accent-color, #38bdf8);
}

.admin-textarea {
  min-height: 70px;
  resize: vertical;
  line-height: 1.4;
}

.admin-error-msg {
  color: #fb7185;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 4px;
  display: none;
}

.admin-error-msg.is-visible {
  display: block;
}

/* Admin Editor Rows */
.editor-scroll-body {
  overflow-y: auto;
  flex: 1;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.editor-team-row {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-team-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.editor-rank-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-rank-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: #fbbf24;
}

.editor-rank-select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 4px 8px;
  cursor: pointer;
}

.editor-team-desc {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}

.editor-team-manager {
  color: var(--accent-color, #38bdf8);
  font-weight: 600;
}

.editor-prev-rank-tag {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.editor-score-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 3px 8px;
}

.editor-score-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #fbbf24;
}

.editor-score-input {
  background: transparent;
  border: none;
  color: #fef08a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  font-weight: 700;
  width: 105px;
  outline: none;
}

.editor-score-input:focus {
  color: #fff;
}

.modal-actions-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.export-toast {
  background: #047857;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  display: none;
}

.export-toast.is-visible {
  display: inline-block;
}

/* Image Card Export & Canvas Preview */
.export-card-btn {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.export-card-btn:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.6);
  color: #fff;
}

.card-preview-scroll-body {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 70vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px;
  background: rgba(10, 15, 26, 0.7);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.image-canvas-mount {
  display: flex;
  justify-content: center;
  width: 100%;
}

.export-power-card-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Media Attachments (Photos & Embedded Videos) in Rank Cards */
.rank-media-frame {
  margin-top: 12px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 640px;
  box-sizing: border-box;
}

.rank-media-frame a {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.rank-media-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  border-radius: 9px;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.rank-media-img:hover {
  filter: brightness(1.05);
}

.rank-media-video-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
  border-radius: 9px;
  background: #000;
}

.rank-media-video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.rank-media-caption {
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
  word-break: break-word;
  overflow-wrap: break-word;
}

.rank-media-badge {
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #c084fc;
}

/* Admin Media Attachment Controls */
.editor-media-section {
  margin-top: 4px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s ease;
}

.editor-media-section.has-media {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.03);
}

.editor-media-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}

.editor-media-type-select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
}

.editor-media-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editor-media-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-media-file-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.editor-media-file-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.editor-media-preview-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.editor-media-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.editor-media-remove-btn {
  background: transparent;
  border: none;
  color: #fb7185;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  margin-left: auto;
  transition: background 0.15s ease;
}

.editor-media-remove-btn:hover {
  background: rgba(251, 113, 133, 0.15);
}


@media (max-width: 640px) {
  .power-rankings-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 16px;
  }

  .power-rankings-header-bar .filter-bar {
    width: 100%;
    display: flex;
    gap: 8px;
    margin: 0;
  }

  .power-rankings-header-bar .filter-group {
    flex: 1;
    min-width: 0;
  }

  .power-rankings-header-bar .filter-select {
    width: 100%;
  }

  .admin-action-wrap {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .admin-action-wrap .admin-btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .admin-badge-active {
    width: 100%;
    justify-content: center;
    text-align: center;
    order: -1;
  }

  /* Editorial Overview Card */
  .editorial-overview-card {
    padding: 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .editorial-overview-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .editorial-headline {
    font-size: 1.05rem;
    word-break: break-word;
  }

  .editorial-author-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
  }

  .editorial-summary-text {
    font-size: 0.85rem;
    line-height: 1.45;
  }

  /* Editorial Rankings Stack */
  .editorial-rankings-stack {
    gap: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .rank-card {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    padding: 12px 10px;
    border-radius: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .rank-badge-col {
    padding-top: 2px;
    gap: 3px;
  }

  .rank-num-badge {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    border-radius: 8px;
  }

  .rank-movement-tag {
    font-size: 0.62rem;
    padding: 1px 4px;
    border-radius: 3px;
  }

  .rank-card-content {
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .rank-team-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .rank-team-title-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
  }

  .rank-team-name {
    font-size: 1.02rem;
    word-break: break-word;
  }

  .rank-team-owner {
    font-size: 0.8rem;
  }

  .rank-stats-pills {
    gap: 4px;
    width: 100%;
  }

  .stat-pill {
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
  }

  .rank-blurb-box {
    padding: 8px 10px;
    border-radius: 6px;
  }

  .rank-blurb-text {
    font-size: 0.84rem;
    line-height: 1.45;
  }

  .rank-media-frame {
    margin-top: 8px;
    border-radius: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .rank-media-frame a {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .rank-media-img {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 240px;
    border-radius: 7px;
  }

  .rank-media-caption {
    font-size: 0.74rem;
    padding: 6px 8px;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Modals & Dialogs */
  .modal-overlay {
    padding: 10px;
  }

  .modal-card {
    padding: 16px 14px;
    border-radius: 12px;
    max-height: 94vh;
  }

  .modal-card.modal-card-wide {
    max-height: 94vh;
  }

  .modal-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
  }

  .modal-title {
    font-size: 1.1rem;
  }

  .modal-actions-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 10px;
  }

  .modal-actions-footer > div {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .modal-actions-footer .pill-link {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 9px 12px;
    box-sizing: border-box;
  }

  .export-toast {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }

  /* Editor rows */
  .editor-team-top {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .editor-team-desc {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
  }

  .editor-score-wrap {
    width: 100%;
    justify-content: space-between;
    box-sizing: border-box;
  }

  .editor-score-input {
    width: 120px;
    text-align: right;
  }

  .editor-media-file-row {
    flex-direction: column;
    align-items: stretch;
  }

  .editor-media-file-btn {
    width: 100%;
    justify-content: center;
  }

  .card-preview-scroll-body {
    max-height: 60vh;
    padding: 6px;
  }
}

@media (max-width: 380px) {
  .admin-action-wrap .admin-btn {
    flex: 1 1 100%;
  }

  .rank-card {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    padding: 10px 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .rank-num-badge {
    width: 32px;
    height: 32px;
    font-size: 1.05rem;
  }
}
