/* NetDraw Frontend Bracket Styles (Basic & Flat theme) */

.netdraw-bracket-container {
    width: 100%;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #334155;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    box-sizing: border-box;
}

.netdraw-bracket-container * {
    box-sizing: border-box;
}

.netdraw-frontend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 12px;
}

.netdraw-badge {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

/* Scroll Wrapper to support wide screen layouts and mobile swiping */
.netdraw-scroll-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 5px 20px 5px;
    display: block;
    width: 100%;
}

.netdraw-scroll-wrapper::-webkit-scrollbar {
    height: 6px;
}

.netdraw-scroll-wrapper::-webkit-scrollbar-track {
    background: #f8fafc;
}

.netdraw-scroll-wrapper::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

/* Flex Tree structure */
.netdraw-bracket-tree {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    align-items: center;
    min-width: max-content;
}

.netdraw-node {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    position: relative;
    padding: 16px 0;
}

.netdraw-children {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding-right: 40px; /* Gap between rounds */
}

/* Flat Card Styling */
.netdraw-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    width: 180px;
    padding: 0;
    z-index: 10;
    position: relative;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.netdraw-card:hover {
    border-color: #94a3b8;
}

/* Active path highlighting styling */
.netdraw-card.highlight-card {
    border-color: #3b82f6;
    background-color: #f8fafc;
}

.netdraw-players-container {
    display: flex;
    flex-direction: column;
}

/* Player slots */
.netdraw-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    transition: all 0.15s ease;
    height: 36px;
}

.netdraw-player.is-tbd {
    color: #94a3b8;
    font-style: italic;
}

.netdraw-player.is-winner {
    font-weight: 700;
    color: #15803d;
    background: #f0fdf4;
}

.netdraw-player.is-loser {
    color: #94a3b8;
}

.netdraw-player.p1-slot {
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
}

.netdraw-player.p2-slot {
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;
}

.netdraw-player.highlight-path {
    background: #dbeafe;
    color: #1e40af;
}

.netdraw-pname {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 156px;
}

.netdraw-divider {
    height: 1px;
    background-color: #e2e8f0;
}

/* Embedded Score Row inside the card flow */
.netdraw-score-row {
    background: #f8fafc;
    border-top: 1px dashed #cbd5e1;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    text-align: center;
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.netdraw-datetime-row {
    background: #f8fafc;
    border-bottom: 1px dashed #cbd5e1;
    color: #64748b;
    font-size: 10px;
    font-weight: 600;
    padding: 5px 12px;
    text-align: center;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* TREE CONNECTOR LINES (Simple flat gray) */
.netdraw-node::before {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    width: 20px; /* half of children's padding-right (40px / 2) */
    height: 1px;
    background-color: #cbd5e1;
    z-index: 5;
}

.netdraw-node.highlight-card::before,
.netdraw-node:has(> .netdraw-card.highlight-card)::before {
    background-color: #3b82f6;
    height: 2px;
}

.netdraw-children::before {
    content: "";
    position: absolute;
    right: 20px;
    top: 50%;
    width: 20px;
    height: 1px;
    background-color: #cbd5e1;
    z-index: 5;
}

.netdraw-node:has(> .netdraw-card.highlight-card) > .netdraw-children::before {
    background-color: #3b82f6;
}

.netdraw-children > .netdraw-node:first-child::after {
    content: "";
    position: absolute;
    right: -20px;
    top: 50%;
    bottom: 0;
    width: 1px;
    background-color: #cbd5e1;
    z-index: 5;
}

.netdraw-children > .netdraw-node:last-child::after {
    content: "";
    position: absolute;
    right: -20px;
    top: 0;
    bottom: 50%;
    width: 1px;
    background-color: #cbd5e1;
    z-index: 5;
}

.netdraw-children > .netdraw-node:first-child:has(> .netdraw-card.highlight-card)::after,
.netdraw-children > .netdraw-node:last-child:has(> .netdraw-card.highlight-card)::after {
    background-color: #3b82f6;
    width: 2px;
}

/* Error message styling */
.netdraw-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.netdraw-loader {
    padding: 30px;
    text-align: center;
    color: #646970;
    font-style: italic;
}
