/* March Madness Bracket - Modern Clean Styles */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.main-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.user-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.nav-btn {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.nav-btn:hover {
    background: #e2e8f0;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Auth Page */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    width: 100%;
    max-width: 450px;
    padding: 1rem;
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
}

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    margin-bottom: -2px;
}

.auth-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.auth-form button[type="submit"] {
    width: 100%;
    margin-top: 0.5rem;
}

/* Tournament List */
.tournament-actions {
    margin-bottom: 1rem;
}

.tournament-list,
.admin-tournament-list {
    display: grid;
    gap: 1rem;
}

.tournament-item,
.admin-tournament-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.admin-tournament-item {
    cursor: default;
}

.tournament-item {
    cursor: default;
}

.tournament-item:hover {
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.admin-tournament-item:hover {
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.tournament-info {
    flex: 1;
}

.tournament-info h3 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.tournament-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.tournament-actions-inline {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tournament-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-delete-tournament {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-tournament:hover {
    background: #fee;
    transform: scale(1.1);
}

.btn-delete-tournament svg {
    display: block;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-setup {
    background: #fef3c7;
    color: #92400e;
}

.status-open {
    background: #dbeafe;
    color: #1e40af;
}

.status-in_progress {
    background: #fce7f3;
    color: #9f1239;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.invite-code {
    font-family: 'Courier New', monospace;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
    background: var(--bg-color);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* Bracket */
.bracket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.bracket-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.bracket-header-left h2 {
    margin: 0;
}

.bracket-actions {
    display: flex;
    gap: 0.75rem;
}

.tiebreaker-section {
    background: var(--bg-color);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.tiebreaker-section label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tiebreaker-section .help-text {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: normal;
    margin-top: 0.25rem;
}

.tiebreaker-section input {
    width: 100%;
    max-width: 200px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

/* Compact tiebreaker section below Championship */
.tiebreaker-section-compact {
    background: var(--bg-color);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin: 1rem auto 0;
    max-width: 400px;
    text-align: center;
}

.tiebreaker-section-compact label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.tiebreaker-section-compact .help-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: normal;
    display: block;
    margin-top: 0.25rem;
}

.tiebreaker-input-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
}

.tiebreaker-section-compact input {
    width: 120px;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    text-align: center;
}

.tiebreaker-section-compact input:disabled {
    background-color: var(--bg-secondary);
    cursor: not-allowed;
    opacity: 0.7;
}

.submit-tiebreaker-btn {
    padding: 0.4rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.submit-tiebreaker-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.submit-tiebreaker-btn:disabled {
    background: var(--success-color);
    cursor: not-allowed;
    opacity: 0.8;
}

.tiebreaker-status {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

.bracket-container {
    position: relative;
    overflow: hidden;
	    padding: 1rem 0;
    height: calc(100vh - 250px);
    min-height: 600px;
}

/* Bracket wrapper - responsive without zoom */
.bracket-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
    position: relative;
    padding: 1rem;
}

/* Mobile tweaks: let the bracket grow vertically and avoid awkward cropping */
@media (max-width: 768px) {
	.bracket-container {
	    height: auto;
	    min-height: 0;
	}

	.bracket-wrapper {
	    height: auto;
	    max-height: none;
	}
}

/* New 4-region bracket layout */
.bracket-container-new {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0;
    min-width: min-content;
}

/* Region tabs container - sticky in header */
#regionTabsContainer {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    margin: 0 -1.5rem;
    padding: 0;
}

/* Region tabs at the top */
.region-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 3px solid var(--border-color);
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.region-tab {
    padding: 0.875rem 1.5rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 120px;
    opacity: 0.7;
}

.region-tab:hover {
    background: white;
    border-color: var(--primary-color);
    color: var(--primary-color);
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.region-tab.active {
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
    border-width: 3px;
    opacity: 1;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transform: translateY(-2px);
}

/* Region content containers */
.region-content {
    display: none;
    padding: 1rem;
}

.region-content.active {
    display: block;
}

/* Individual region bracket display */
.region-bracket-display {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    position: relative;
}

/* Remove old region-rounds styling - no longer needed */

.bracket-round {
    min-width: 180px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

.bracket-round.round-1 {
    min-width: 200px;
}

.bracket-round.round-2 {
    min-width: 180px;
}

.bracket-round.round-3 {
    min-width: 180px;
}

.bracket-round.round-4 {
    min-width: 200px;
}

.bracket-round.round-5 {
    min-width: 200px;
}

/* Round matchups container for proper spacing - grid-based for bracket tree */
.round-matchups-container {
	    display: grid;
	    /* Each grid row represents a fixed vertical slot in the bracket tree. */
	    grid-auto-rows: 80px; /* fixed height so rows line up consistently across rounds */
	    row-gap: 0.5rem;
	    padding-top: 0.25rem;
	    padding-bottom: 0.25rem;
}

/* Matchup wrapper for bracket tree spacing */
.matchup-wrapper {
	    position: relative;
}

/* Finals section (Final Four + Championship) */
.bracket-finals-section {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    border: 2px solid var(--primary-color);
}

.finals-round {
    margin-bottom: 2rem;
}

.finals-round:last-child {
    margin-bottom: 0;
}

.finals-matchups {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.final-four-game {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

.final-four-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Round title spacer for non-first regions */
.round-title-spacer {
    height: 60px;
    margin-bottom: 1rem;
}



/* Old bracket styles (keep for backwards compatibility) */
.bracket-rounds {
    display: flex;
    gap: 2rem;
    min-width: min-content;
}

.round-title {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.round-points {
    display: block;
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-top: 0.25rem;
    text-transform: none;
    letter-spacing: normal;
}

.bracket-region-section {
    margin-bottom: 2rem;
}

.bracket-region-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-color);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-sm);
}

.round-matchups {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.matchup {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.625rem;
    transition: all 0.2s;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

/* Bracket tree lines (optional - can be added later) */
.matchup::before,
.matchup::after {
    content: '';
    position: absolute;
    border: 1px solid var(--border-color);
}

/* All matchups same size for consistent alignment */
.round-1 .matchup,
.round-2 .matchup,
.round-3 .matchup,
.round-4 .matchup,
.round-5 .matchup,
.championship-matchup .matchup {
    min-height: 80px;
}

.matchup:hover:not(.locked) {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.matchup.locked {
    opacity: 0.7;
}

.matchup-game {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.team {
    padding: 0.5rem 0.625rem;
    margin-bottom: 0.375rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: white;
    font-size: 0.9rem;
}

.team:hover:not(.team-empty) {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

.team.selected {
    background: #dbeafe;
    border-color: var(--primary-color);
    font-weight: 600;
}

.team.winner {
    background: #d1fae5;
    border-color: var(--success-color);
}

/* Pick status color coding */
.team.pick-pending {
    background: #fef3c7 !important;
    border-color: #f59e0b !important;
    border-width: 2px;
}

.team.pick-correct {
    background: #d1fae5 !important;
    border-color: #10b981 !important;
    border-width: 2px;
}

.team.pick-incorrect {
    background: #fee2e2 !important;
    border-color: #ef4444 !important;
    border-width: 2px;
}

.team-empty {
    color: var(--text-secondary);
    cursor: default;
    font-style: italic;
}

.team-seed {
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 1.5rem;
}

.team-name {
    flex: 1;
}

.pick-indicator {
    color: var(--primary-color);
    font-weight: 700;
}

.predicted-indicator {
    font-size: 0.875rem;
    opacity: 0.7;
}

.team.predicted {
    opacity: 0.75;
    font-style: italic;
    border-style: dashed;
}

.team.predicted:hover {
    opacity: 1;
}

.winner-indicator {
    text-align: center;
    font-size: 0.75rem;
    color: var(--success-color);
    font-weight: 600;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-large {
    max-width: 800px;
}

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

.modal-header h3 {
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.close-modal:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.modal-content form {
    padding: 1.5rem;
}

.modal-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Join modal - visibility controls */
.radio-group {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.radio-group label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.9rem;
}

/* Participants panel in bracket view */
.participants-panel {
	margin-top: 0.75rem;
	margin-bottom: 0.75rem;
	padding: 0.75rem 1rem;
	background: var(--bg-color);
	border-radius: var(--radius-md);
	border: 1px solid var(--border-color);
}

.participants-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.5rem;
}

.participants-title {
	font-weight: 600;
	font-size: 0.95rem;
}

.participants-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
}

.participant-item {
	font-size: 0.85rem;
	padding: 0.25rem 0.5rem;
	border-radius: var(--radius-sm);
	background: white;
}

.participant-me {
	border: 1px solid var(--primary-color);
	background: #eff6ff;
}

.participant-main {
	display: flex;
	align-items: center;
	gap: 0.375rem;
}

.participant-name {
	font-weight: 600;
}

.participant-badge {
	font-size: 0.7rem;
	padding: 0.1rem 0.35rem;
	background: var(--primary-color);
	color: white;
	border-radius: 999px;
}

.participant-meta {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.15rem;
	font-size: 0.8rem;
	color: var(--text-secondary);
}

.participant-visibility-open {
	color: var(--success-color);
}

/* Admin: participants table in admin dashboard */
.participants-admin-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 0.75rem;
	font-size: 0.9rem;
}

.participants-admin-table th,
.participants-admin-table td {
	padding: 0.45rem 0.6rem;
	border-bottom: 1px solid var(--border-color);
	vertical-align: middle;
}

.participants-admin-table th {
	text-align: left;
	font-weight: 600;
	color: var(--text-secondary);
	background: #f9fafb;
}

/* Right-align numeric column headers so they line up with numeric cells */
.participants-admin-table th:nth-child(2),
.participants-admin-table th:nth-child(3),
.participants-admin-table th:nth-child(4) {
	text-align: right;
}

.participants-admin-table tbody tr:nth-child(even) {
	background: #f9fafb;
}

.participants-admin-table .numeric-cell {
	text-align: right;
	white-space: nowrap;
}

.participants-admin-table td:last-child {
	text-align: right;
	white-space: nowrap;
}

.participants-admin-table td:last-child .btn {
	margin-left: 0.25rem;
	padding: 0.25rem 0.6rem;
	font-size: 0.75rem;
}

.participants-admin-table .participant-name {
	display: block;
}

.participants-admin-table .participant-username {
	display: block;
	font-size: 0.8rem;
	color: var(--text-secondary);
}

.participant-visibility-private {
	color: var(--warning-color);
}

/* Leaderboard */
.leaderboard-content {
    padding: 1.5rem;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table thead {
    background: var(--bg-color);
}

.leaderboard-table th {
    padding: 0.75rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.leaderboard-table td {
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.leaderboard-table tr:hover {
    background: var(--bg-color);
}

.leaderboard-table tr.current-user {
    background: #dbeafe;
    font-weight: 600;
}

.leaderboard-table .rank {
    font-weight: 700;
    color: var(--primary-color);
}

.leaderboard-table .points {
    font-weight: 700;
    color: var(--success-color);
}

/* Admin Styles */
.setup-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.setup-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    margin-bottom: -2px;
}

.setup-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.teams-table,
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.teams-table th,
.results-table th {
    background: var(--bg-color);
    padding: 0.75rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.teams-table td,
.results-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.teams-list,
.matchups-list,
.results-list {
    margin-top: 1.5rem;
}

.matchups-grid,
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.matchup-card,
.result-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.result-header {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.result-teams {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-team {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.result-team:hover {
    background: white;
    border-color: var(--primary-color);
}

.result-team.winner {
    background: #d1fae5;
    border-color: var(--success-color);
    font-weight: 600;
}

.result-team input[type="radio"] {
    cursor: pointer;
}

.result-status {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--success-color);
    font-weight: 600;
}

/* Messages */
.error-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.success-message {
    color: var(--success-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-style: italic;
}

.empty-state-with-action {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state-with-action .btn {
    margin: 1.5rem auto 1rem;
    display: inline-flex;
    align-items: center;
}

.empty-state-with-action .help-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .header-left h1 {
        font-size: 1.25rem;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .container {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }

    .bracket-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .bracket-actions {
        width: 100%;
        flex-direction: column;
    }

    .bracket-actions .btn {
        width: 100%;
    }

    .bracket-rounds {
        gap: 1rem;
    }

    .bracket-round {
        min-width: 200px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .matchups-grid,
    .results-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 1rem;
    }

    .tournament-item,
    .admin-tournament-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }

    .bracket-round {
        min-width: 180px;
    }

    .team {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}

/* Bracket-style Teams Display */
.bracket-teams-container {
    margin-top: 2rem;
}

.bracket-regions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.bracket-region {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.bracket-region:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.region-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.region-teams {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 200px;
}

.matchup-pair {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.matchup-pair:hover {
    border-color: var(--border-color);
    background: white;
}

.vs-divider {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0;
}

.empty-region {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem 1rem;
    font-style: italic;
}

.team-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    position: relative;
}

.team-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
}

.team-placeholder {
    background: #f1f5f9;
    border-style: dashed;
    opacity: 0.6;
}

.team-placeholder .team-seed {
    background: var(--text-secondary);
}

.team-placeholder .team-name {
    color: var(--text-secondary);
    font-style: italic;
}

.team-placeholder:hover {
    transform: none;
    box-shadow: none;
}

.team-seed {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.team-info {
    flex: 1;
    min-width: 0;
}

.team-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-card.editable .team-name {
    cursor: text;
    padding: 0.25rem 0.5rem;
    margin: -0.25rem -0.5rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
}

.team-card.editable .team-name:hover {
    background-color: var(--bg-color);
}

.team-card.editable .team-name:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    background-color: white;
}

.btn-delete {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.team-card:hover .btn-delete {
    opacity: 1;
}

.btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

.region-count {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.add-team-form {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Responsive adjustments for bracket teams */
@media (max-width: 768px) {
    .bracket-regions {
        grid-template-columns: 1fr;
    }

    .team-card {
        padding: 0.625rem;
    }

    .team-seed {
        width: 28px;
        height: 28px;
        font-size: 0.8125rem;
    }

    .btn-delete {
        opacity: 1;
    }
}

/* Matchups Display */
.round-section {
    margin-bottom: 2.5rem;
}

.round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--primary-color);
}

.round-header h4 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.region-matchups-section {
    margin-bottom: 2rem;
}

.region-matchups-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-md);
}

.matchup-card {
    position: relative;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.matchup-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.matchup-card:hover .btn-delete-matchup {
    opacity: 1;
}

.btn-delete-matchup {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.btn-delete-matchup:hover {
    background: var(--danger-color);
    color: white;
}

.matchup-info {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.game-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.matchup-teams {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.team-seed-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 0.375rem;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    border-radius: 50%;
}

.vs-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.matchup-region {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.matchup-card .winner {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--success-color);
}

@media (max-width: 768px) {
    .round-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .btn-delete-matchup {
        opacity: 1;
    }
}

/* Results Display */
.results-round-section {
    margin-bottom: 2.5rem;
}

.results-round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--primary-color);
}

.results-round-header h4 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
}

.region-results-section {
    margin-bottom: 2rem;
}

.region-results-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.region-progress-small {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: white;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
}

.round-progress {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-color);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
}

.result-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.result-card.completed {
    border-color: var(--success-color);
    background: #f0fdf4;
}

.result-card.pending {
    opacity: 0.6;
    background: #f8fafc;
}

.result-card:hover:not(.pending) {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.game-label {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.game-region {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    background: #eff6ff;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
}

.result-teams {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.vs-separator {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.25rem 0;
}

.result-team {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.result-team:hover {
    border-color: var(--primary-color);
    background: white;
}

.result-team.winner {
    border-color: var(--success-color);
    background: #f0fdf4;
}

.result-team input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.team-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.team-info .seed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.team-info .team-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Editable team names in admin */
.editable-team-name {
    cursor: text;
    padding: 0.25rem 0.5rem;
    margin: -0.25rem -0.5rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
    display: inline-block;
}

.editable-team-name:hover {
    background-color: var(--bg-secondary);
    outline: 1px dashed var(--border-color);
}

.editable-team-name:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    background-color: white;
}

.winner-badge {
    margin-left: auto;
    font-size: 1.25rem;
    color: var(--success-color);
    font-weight: 700;
}

.result-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.btn-clear-winner {
    background: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-winner:hover {
    background: var(--danger-color);
    color: white;
}

.pending-teams {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Notifications */
.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    z-index: 1000;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-success {
    border-color: var(--success-color);
    background: #f0fdf4;
    color: var(--success-color);
}

.notification-error {
    border-color: var(--danger-color);
    background: #fef2f2;
    color: var(--danger-color);
}

.notification-info {
    border-color: var(--primary-color);
    background: #eff6ff;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .results-round-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .result-team {
        padding: 0.75rem;
    }

    .team-info .team-name {
        font-size: 0.875rem;
    }

    .notification {
        right: 1rem;
        left: 1rem;
        top: 1rem;
    }
}

