/* Wrapper */
.mfb-bracket-wrapper {
    width: 100%;
    overflow-x: auto;
    padding: 1rem 0;
    text-align: center;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.mfb-tournament-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #111827;
    letter-spacing: .06em;
}

/* Bracket layout */
.mfb-bracket {
    display: inline-flex;
    gap: 3rem;
    align-items: stretch;
    justify-content: center;
    text-align: left;
}

.mfb-round {
    min-width: 230px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.mfb-round-title {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    color: #4b5563;
}

.mfb-round-matches {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 1.4rem;
    justify-content: space-around;
}

/* Match card (front del bracket) */
.mfb-match {
    background: #ffffff;
    border-radius: 14px;
    padding: 0.7rem 0.9rem;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.45);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    position: relative;
}

/* Connection lines between rounds */
.mfb-round:not(:last-child) .mfb-match::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -1.5rem;
    width: 1.5rem;
    border-top: 2px solid rgba(148, 163, 184, 0.9);
}

.mfb-round + .mfb-round .mfb-match::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -1.5rem;
    width: 1.5rem;
    border-top: 2px solid rgba(148, 163, 184, 0.9);
}

/* Team rows */
.mfb-team-row {
    display: flex;
    align-items: flex-start;   /* alinear por arriba */
    justify-content: space-between;
    padding: 0.25rem 0.3rem;
    border-radius: 0.6rem;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.mfb-team {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.mfb-team-logo img {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    object-fit: cover;
    background: #e5e7eb;
}

.mfb-team-name {
    display: block;
    white-space: normal;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.mfb-scores {
    display: flex;
    align-items: baseline;
    gap: 0.15rem;
    font-variant-numeric: tabular-nums;
}

.mfb-score-main {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
}

.mfb-score-pen {
    font-size: 0.9rem;
    color: #6b7280;
}

/* Winner highlight */
.mfb-team-row.mfb-winner {
    background: linear-gradient(135deg, rgba(59,130,246,0.10), rgba(16,185,129,0.10));
    box-shadow: 0 0 0 1px rgba(59,130,246,0.65);
    transform: translateY(-1px);
}

.mfb-team-row.mfb-winner .mfb-team-name {
    font-weight: 700;
}

.mfb-pen-label {
    margin-top: 0.15rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
}

/* Footer */
.mfb-match-footer {
    margin-top: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.mfb-match-meta {
    font-weight: 700;
    color: #111827;
    text-align: left;
}

.mfb-match-meta div {
    line-height: 1.1;
}

.mfb-live-badge {
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    animation: mfb-blink 1s ease-in-out infinite;
}

/* Animaciones marcador vivo */
.mfb-score-live {
    animation: mfb-blink 1s ease-in-out infinite;
}

/* Durante penales */
.mfb-score-regular-live {
    color: #9ca3af;
    font-weight: 600;
}

.mfb-score-pen-live {
    color: #111827;
    font-weight: 800;
    animation: mfb-blink 1s ease-in-out infinite;
}

@keyframes mfb-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* Admin (resumen) */
.mfb-admin-wrapper {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.mfb-admin-rounds {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mfb-admin-matches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1rem;
}

.mfb-admin-match-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.75rem;
    background: #ffffff;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .mfb-round {
        min-width: 200px;
    }

    .mfb-team-name {
        font-size: 0.95rem;
    }

    .mfb-score-main {
        font-size: 1rem;
    }

    .mfb-tournament-title {
        font-size: 1.5rem;
    }
}

/* =========================================
   LÍNEAS VERTICALES ENTRE BRACKETS
   ========================================= */
.mfb-bracket-column:not(:first-child) .mfb-bracket-match:nth-child(2n)::before {
    content: "";
    position: absolute;
    left: -25px;
    top: -50%;
    width: 2px;
    height: calc(100% + 50%);
    background: #8aa0b3;
}

/* Goleadores en el FRONT del bracket */
.mfb-scorers-block {
    display: block;
    margin-top: 2px;
}

.mfb-scorers-line {
    display: block;
    font-family: "Courier New", Courier, monospace;
    font-size: 11px;
    line-height: 1.3;
}

.mfb-scorer-ball {
    margin-right: 4px;
}

.mfb-scorer-text {
    font-weight: 400;
}

.mfb-champion-label {
    margin-top: 2px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #f59e0b;
}

/* ==========================
   Panel de resultados en vivo (shortcode)
   =========================== */

.mfb-results-frontend {
    max-width: 100%;
    margin: 1.5rem auto;
    padding: 1rem 1.25rem;
    background: #f9fafb;
    border-radius: 0.75rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Quitamos márgenes raros del .wrap que trae el admin */
.mfb-results-frontend .wrap {
    margin: 0;
    padding: 0;
}

/* Título dentro del panel en el front */
.mfb-results-frontend .wrap > h1 {
    font-size: 1.4rem;
    margin: 0 0 0.75rem 0;
    font-weight: 700;
    color: #111827;
}

/* Contenedor con scroll horizontal (por si hay algo ancho) */
.mfb-results-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Estilos heredados por si se usa tabla widefat aún */
.mfb-results-scroll table.widefat {
    min-width: 980px;
    border-collapse: collapse;
}

.mfb-results-scroll table.widefat thead th {
    background: #111827;
    color: #f9fafb;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.45rem 0.6rem;
    white-space: nowrap;
}

.mfb-results-scroll table.widefat td {
    font-size: 0.85rem;
    padding: 0.35rem 0.6rem;
    white-space: nowrap;
}

.mfb-results-scroll table.widefat tbody tr:nth-child(odd) {
    background: #f9fafb;
}

.mfb-results-scroll table.widefat tbody tr:nth-child(even) {
    background: #f3f4f6;
}

.mfb-results-scroll table.widefat tbody tr:hover {
    background: #e5f0ff;
}

.mfb-results-scroll input[type="number"],
.mfb-results-scroll input[type="text"],
.mfb-results-scroll textarea {
    width: 100%;
    max-width: 170px;
    font-size: 0.8rem;
    padding: 0.25rem 0.4rem;
    border-radius: 0.35rem;
    border: 1px solid #d1d5db;
    box-sizing: border-box;
}

.mfb-results-scroll input[type="checkbox"] {
    transform: scale(1.1);
}

/* Botón guardar más visible */
.mfb-results-frontend .wrap form p.submit input[type="submit"],
.mfb-results-frontend .wrap input[type="submit"] {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #fff;
    padding: 0.45rem 1.1rem;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

.mfb-results-frontend .wrap form p.submit input[type="submit"]:hover,
.mfb-results-frontend .wrap input[type="submit"]:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

/* === Panel de resultados (tarjetas) – estilo claro === */

.mfb-results-panel {
    max-width: 1100px;
    margin: 20px auto;
    padding: 20px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    color: #111827;
}

.mfb-results-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.mfb-results-select-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 500;
    color: #374151;
}

.mfb-results-select-bracket {
    min-width: 260px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #111827;
}

.mfb-results-save {
    border-radius: 999px !important;
    padding: 8px 18px !important;
    font-weight: 600;
}

.mfb-results-save--busy {
    opacity: 0.7;
    cursor: progress;
}

.mfb-results-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 14px;
    background: transparent;
    border: 1px solid transparent;
    min-height: 0;
}

.mfb-results-message--info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.mfb-results-message--success {
    background: #ecfdf3;
    border-color: #bbf7d0;
    color: #166534;
}

.mfb-results-message--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.mfb-results-matches {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.mfb-results-matches--loading {
    opacity: 0.6;
    pointer-events: none;
}

.mfb-round-block {
    border-radius: 10px;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.mfb-round-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin: 0 0 10px;
}

.mfb-round-matches-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

@media (min-width: 900px) {
    .mfb-round-matches-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

.mfb-match-card {
    border-radius: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.mfb-match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #9ca3af;
    margin-bottom: 6px;
}

.mfb-match-id {
    font-weight: 600;
}

.mfb-match-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mfb-team-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mfb-team-row--home .mfb-team-name {
    color: #111827;
    font-weight: 600;
}

.mfb-team-row--away .mfb-team-name {
    color: #374151;
    font-weight: 500;
}

.mfb-team-name {
    flex: 1;
    font-size: 14px;
}

.mfb-score-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 2px 6px;
    border: 1px solid #e5e7eb;
}

.mfb-score-input {
    width: 46px;
    text-align: center;
    border: none;
    background: transparent;
    color: #111827;
    font-weight: 700;
    font-size: 14px;
    outline: none;
    -moz-appearance: textfield;
}

.mfb-score-input::-webkit-outer-spin-button,
.mfb-score-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mfb-score-btn {
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #111827;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mfb-score-btn:hover {
    background: #2563eb;
    color: #ffffff;
}

.mfb-penalties-row {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #e5e7eb;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}

.mfb-penalties-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #374151;
}

.mfb-penalties-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mfb-score-wrapper--pen {
    padding: 2px 8px;
}

.mfb-pen-label {
    font-size: 12px;
    color: #6b7280;
}

.mfb-match-footer-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

.mfb-match-save--busy {
    opacity: 0.7;
    cursor: progress;
}

/* === Goleadores + partido finalizado dentro de la tarjeta === */

.mfb-scorers-edit-row {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #e5e7eb;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

@media (min-width: 800px) {
    .mfb-scorers-edit-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

.mfb-scorers-edit-col label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
}

.mfb-scorers-textarea {
    width: 100%;
    margin-top: 4px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.4;
    box-sizing: border-box;
    resize: none;
    background: #f3f4f6;
    font-family: "Courier New", Courier, monospace;
}

.mfb-scorers-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb;
    background: #eff6ff;
}

.mfb-finished-row {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #e5e7eb;
}

.mfb-finished-flag {
    font-size: 13px;
    color: #374151;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

/* Forzar estilo moderno a las casillas de goleadores
   aunque no tengan clase extra */
.mfb-scorers-edit-col textarea,
.mfb-results-panel .mfb-scorers-edit-col textarea {
    width: 100%;
    margin-top: 4px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.4;
    box-sizing: border-box;
    resize: none;
    background: #f3f4f6;
    font-family: "Courier New", Courier, monospace;
}

.mfb-scorers-edit-col textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb;
    background: #eff6ff;
}

/* Igualar estilo exacto de ambas casillas de goleadores */
.mfb-scorers-edit-col textarea {
    display: block;
    width: 100%;
    height: 40px;
    padding: 10px 14px;
    border-radius: 999px !important;
    border: 1px solid #e5e7eb !important;
    background: #f3f4f6 !important;
    font-size: 13px !important;
    font-family: "Inter", system-ui, sans-serif !important;
    color: #111827 !important;
    resize: none !important;
    line-height: 1.4;
}

/* Focus elegante */
.mfb-scorers-edit-col textarea:focus {
    outline: none !important;
    border: 2px solid #2563eb !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .25) !important;
}
/* Forzar estilo correcto en el BRACKET (front) */
.mfb-bracket .mfb-team-row {
    align-items: flex-start;      /* para que el nombre y goleadores queden uno bajo otro */
    padding: 0.25rem 0.3rem;
}

.mfb-bracket .mfb-team-name {
    display: block;
    white-space: normal;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}
