/* =========================================================
   Match Media — News & AI Generator
   Aligned with .match-stats-box / .match-header-box theme
   ========================================================= */

.match-media-extra {
  --mma-accent: #f15b2e;
  --mma-accent-dark: #d14821;
  --mma-ink: #1a1a1a;
  --mma-muted: #64748b;
  --mma-surface: #ffffff;
  --mma-border: #f15b2e;
  --mma-soft: #fff7f4;
  --mma-radius: 0.8rem;

  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  margin-top: 1.6rem;
  font-family: "Montserrat", sans-serif;
}

/* Cards — same language as match-stats-box */
.match-media-extra .match-media-card {
  background: var(--mma-surface);
  border: 1px solid var(--mma-border);
  border-radius: var(--mma-radius);
  box-shadow: 0 2px 8px rgba(241, 91, 46, 0.08);
  overflow: hidden;
}

.match-media-extra .match-media-card__header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid var(--mma-border);
  background: linear-gradient(180deg, #fff 0%, #fffaf8 100%);
}

.match-media-extra .match-media-card__icon {
  width: 1.8rem;
  height: 1.8rem;
  color: var(--mma-accent);
  flex-shrink: 0;
}

.match-media-extra .match-media-card__title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--mma-ink);
  letter-spacing: -0.01em;
}

.match-media-extra .match-media-card__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.match-media-extra .match-media-card__body {
  padding: 1.6rem;
}

/* Buttons */
.match-media-extra .mma-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 0.4rem;
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}

.match-media-extra .mma-btn--primary {
  background: var(--mma-accent);
  color: #fff;
  padding: 0.65rem 1.1rem;
  box-shadow: 0 2px 6px rgba(241, 91, 46, 0.25);
}

.match-media-extra .mma-btn--primary:hover {
  background: var(--mma-accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(241, 91, 46, 0.3);
}

.match-media-extra .mma-btn--primary:disabled,
.match-media-extra .mma-btn--primary.is-generating {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  pointer-events: none;
}

.match-media-extra .mma-btn--primary:disabled:hover,
.match-media-extra .mma-btn--primary.is-generating:hover {
  background: var(--mma-accent);
  transform: none;
  box-shadow: none;
}

.match-media-extra .mma-btn--ghost {
  background: transparent;
  color: var(--mma-accent);
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(241, 91, 46, 0.35);
}

.match-media-extra .mma-btn--ghost:hover {
  background: var(--mma-soft);
}

.match-media-extra .mma-btn--icon {
  width: 3.4rem;
  height: 3.4rem;
  padding: 0;
  border-radius: 0.5rem;
}

.match-media-extra .mma-btn--edit {
  background: #3a3a44;
  color: #fff;
}

.match-media-extra .mma-btn--edit:hover {
  background: #4a4a54;
}

.match-media-extra .mma-btn--delete {
  background: #ef4444;
  color: #fff;
}

.match-media-extra .mma-btn--delete:hover {
  background: #dc2626;
}

/* News list */
.match-media-extra .news-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.match-media-extra .news-item {
  display: grid;
  grid-template-columns: 9.6rem 1fr auto;
  gap: 1.2rem;
  align-items: start;
  padding: 1.2rem;
  border: 1px solid #eceff3;
  border-radius: 0.6rem;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.match-media-extra .news-item:hover {
  border-color: rgba(241, 91, 46, 0.45);
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.06);
}

.match-media-extra .news-item__image {
  width: 9.6rem;
  height: 6.4rem;
  border-radius: 0.5rem;
  overflow: hidden;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
}

.match-media-extra .news-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.match-media-extra .news-item__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
}

.match-media-extra .news-item__content {
  min-width: 0;
  text-align: left;
}

.match-media-extra .news-item__title {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--mma-ink);
}

.match-media-extra .news-item__meta {
  margin-bottom: 0.5rem;
}

.match-media-extra .news-item__date {
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--mma-muted);
  background: #f1f5f9;
  padding: 0.2rem 0.55rem;
  border-radius: 0.3rem;
}

.match-media-extra .news-item__excerpt {
  margin: 0 0 0.75rem;
  font-size: 1.3rem;
  line-height: 1.55;
  color: var(--mma-muted);
}

.match-media-extra .news-item__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--mma-accent);
  background: var(--mma-soft);
  color: var(--mma-accent);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.match-media-extra .news-item__link:hover {
  background: var(--mma-accent);
  color: #fff;
}

.match-media-extra .news-item__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.match-media-extra .match-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #eef6ff 0%, #e8f4fd 100%);
  border: 1px solid #b6d9f5;
  color: #0369a1;
  font-size: 1rem;
  font-weight: 700;
  vertical-align: middle;
}

.match-media-extra .match-draft-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #c2410c;
  font-size: 1rem;
  font-weight: 700;
  vertical-align: middle;
}

.match-media-extra .news-item--draft {
  border-color: #fed7aa;
  background: linear-gradient(180deg, #fffbf7 0%, #fff 100%);
}

.match-media-extra .mma-btn--sm {
  padding: 0.35rem 0.75rem;
  font-size: 1.2rem;
  line-height: 1.2;
}

/* Empty state */
.match-media-extra .news-empty {
  text-align: center;
  padding: 2.4rem 1.6rem;
  border: 1px dashed #e2e8f0;
  border-radius: 0.6rem;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.match-media-extra .news-empty__icon {
  width: 4.8rem;
  height: 4.8rem;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--mma-soft);
  color: var(--mma-accent);
}

.match-media-extra .news-empty__title {
  margin: 0 0 0.4rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--mma-ink);
}

.match-media-extra .news-empty__text {
  margin: 0 0 1.2rem;
  font-size: 1.3rem;
  color: var(--mma-muted);
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

/* AI form */
.match-media-extra .match-ai-form {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.match-media-extra .match-ai-field label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--mma-ink);
}

.match-media-extra .match-ai-field select,
.match-media-extra .match-ai-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.4rem;
  background: #fff;
  color: var(--mma-ink);
  font-family: inherit;
  font-size: 1.35rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.match-media-extra .match-ai-field select:focus,
.match-media-extra .match-ai-field textarea:focus {
  outline: none;
  border-color: var(--mma-accent);
  box-shadow: 0 0 0 3px rgba(241, 91, 46, 0.15);
}

.match-media-extra .match-ai-template-desc {
  margin: -0.6rem 0 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--mma-accent);
  background: var(--mma-soft);
  border-radius: 0 0.4rem 0.4rem 0;
  font-size: 1.25rem;
  line-height: 1.5;
  color: #475569;
}

.match-media-extra .match-ai-template-desc:empty {
  display: none;
}

.match-media-extra .match-ai-sources {
  border: none;
  margin: 0;
  padding: 0;
}

.match-media-extra .match-ai-sources legend {
  margin-bottom: 0.75rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--mma-ink);
}

.match-media-extra .match-ai-sources__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.match-media-extra .match-ai-source-chip {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  font-size: 1.25rem;
  line-height: 1.4;
  color: #334155;
}

.match-media-extra .match-ai-source-chip:hover {
  border-color: rgba(241, 91, 46, 0.4);
  background: #fffdfb;
}

.match-media-extra .match-ai-source-chip:has(input:checked) {
  border-color: var(--mma-accent);
  background: var(--mma-soft);
  box-shadow: inset 0 0 0 1px rgba(241, 91, 46, 0.15);
}

.match-media-extra .match-ai-source-chip input {
  margin-top: 0.15rem;
  accent-color: var(--mma-accent);
  flex-shrink: 0;
}

.match-media-extra .match-ai-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.4rem;
  border-top: 1px solid #f1f5f9;
}

.match-media-extra .match-ai-hint {
  font-size: 1.2rem;
  color: var(--mma-muted);
  max-width: 28rem;
  line-height: 1.45;
}

.match-media-extra .match-ai-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--mma-accent);
}

.match-media-extra .match-ai-loading::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(241, 91, 46, 0.25);
  border-top-color: var(--mma-accent);
  border-radius: 50%;
  animation: mma-spin 0.7s linear infinite;
}

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

/* Modal */
.single-match .news-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.6rem;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.single-match .news-modal__overlay {
  position: absolute;
  inset: 0;
}

.single-match .news-modal__content {
  position: relative;
  width: min(76rem, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: 1rem;
  border: 1px solid #f15b2e;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  font-family: "Montserrat", sans-serif;
}

.single-match .news-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid #f15b2e;
  background: linear-gradient(180deg, #fff 0%, #fffaf8 100%);
}

.single-match .news-modal__title {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  color: #1a1a1a;
}

.single-match .news-modal__close {
  width: 3.2rem;
  height: 3.2rem;
  border: none;
  border-radius: 0.4rem;
  background: #f1f5f9;
  color: #64748b;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.single-match .news-modal__close:hover {
  background: #e2e8f0;
  color: #1a1a1a;
}

.single-match .news-modal__body {
  padding: 1.6rem;
  overflow-y: auto;
  flex: 1;
}

.single-match .news-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  padding: 1.2rem 1.6rem;
  border-top: 1px solid #f1f5f9;
  background: #fafbfc;
}

.single-match .news-modal .form-group {
  margin-bottom: 1.2rem;
}

.single-match .news-modal .form-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a1a1a;
}

.single-match .news-modal .form-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.4rem;
  font-size: 1.35rem;
  font-family: inherit;
}

.single-match .news-modal .form-input:focus {
  outline: none;
  border-color: #f15b2e;
  box-shadow: 0 0 0 3px rgba(241, 91, 46, 0.15);
}

.single-match .news-modal .btn-cancel {
  padding: 0.65rem 1.1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  background: #fff;
  font-size: 1.3rem;
  font-weight: 600;
  cursor: pointer;
}

.single-match .news-modal .btn-save {
  padding: 0.65rem 1.2rem;
  border: none;
  border-radius: 0.4rem;
  background: #f15b2e;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(241, 91, 46, 0.25);
}

.single-match .news-modal .btn-upload {
  margin-top: 0.6rem;
  padding: 0.5rem 0.9rem;
  border: none;
  border-radius: 0.4rem;
  background: #3a3a44;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
}

.single-match .thumbnail-preview img {
  max-width: 20rem;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
  .match-media-extra .news-item {
    grid-template-columns: 1fr;
  }

  .match-media-extra .news-item__image {
    width: 100%;
    height: 12rem;
  }

  .match-media-extra .match-ai-sources__grid {
    grid-template-columns: 1fr;
  }

  .match-media-extra .match-media-card__header {
    flex-wrap: wrap;
  }

  .match-media-extra .match-media-card__actions {
    width: 100%;
    justify-content: flex-end;
  }
}
