/* Rugby Dashboard Custom Styles */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-bg: #f8f9fa;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-bg);
}

/* Section Titles */
.section-title {
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--primary-color);
}

/* Stat Cards */
.stat-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stat-card .card-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.stat-card .card-subtitle {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: white;
    border-bottom: 2px solid var(--light-bg);
    font-weight: 600;
}

/* Tables */
.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
    cursor: pointer;
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    color: #6c757d;
}

/* Charts */
.chart-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

#offense-chart,
#defense-chart,
#player-chart,
#comparison-chart {
    min-height: 400px;
}

/* D3 Specific Styles */
.bar {
    transition: opacity 0.2s;
}

.bar:hover {
    opacity: 0.8;
}

.axis text {
    font-size: 12px;
    fill: #666;
}

.axis path,
.axis line {
    stroke: #dee2e6;
    shape-rendering: crispEdges;
}

.grid line {
    stroke: #e9ecef;
    stroke-opacity: 0.7;
    shape-rendering: crispEdges;
}

.grid path {
    stroke-width: 0;
}

/* Tooltip */
.tooltip-d3 {
    position: absolute;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    border-radius: 5px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

.tooltip-d3::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

/* Scatter plot points */
.scatter-point {
    stroke: white;
    stroke-width: 1.5px;
    transition: r 0.2s, opacity 0.2s;
}

.scatter-point:hover {
    r: 7;
    opacity: 1;
}

/* Error bars */
.error-bar {
    stroke: #6c757d;
    stroke-width: 1.5px;
}

.error-cap {
    stroke: #6c757d;
    stroke-width: 2px;
}

/* Navigation */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.nav-link {
    font-weight: 500;
    transition: color 0.2s;
}

/* Tabs */
.nav-tabs .nav-link {
    color: #6c757d;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 500;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: transparent;
}

/* Form Controls */
.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.form-select,
.form-control {
    border-radius: 8px;
    border: 2px solid #dee2e6;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-select:focus,
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* Alert */
.alert {
    border-radius: 10px;
    border: none;
}

.alert-info {
    background-color: rgba(13, 202, 240, 0.1);
    color: #055160;
}

/* Footer */
footer {
    margin-top: 5rem;
}

footer a {
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .stat-card {
        margin-bottom: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    #offense-chart,
    #defense-chart,
    #player-chart,
    #comparison-chart {
        min-height: 300px;
    }

    .table {
        font-size: 0.875rem;
    }
}

/* Rank Badges */
.rank-badge {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    border-radius: 50%;
    text-align: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.rank-badge.gold {
    background-color: #ffd700;
    color: #000;
}

.rank-badge.silver {
    background-color: #c0c0c0;
    color: #000;
}

.rank-badge.bronze {
    background-color: #cd7f32;
    color: #fff;
}

.rank-badge.default {
    background-color: var(--light-bg);
    color: #666;
}

/* Uncertainty Badge */
.uncertainty-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.uncertainty-badge.low {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.uncertainty-badge.medium {
    background-color: rgba(255, 193, 7, 0.1);
    color: #856404;
}

.uncertainty-badge.high {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Legend */
.legend {
    font-size: 12px;
}

.legend-item {
    margin-right: 15px;
    display: inline-flex;
    align-items: center;
}

.legend-color {
    width: 20px;
    height: 20px;
    margin-right: 5px;
    border-radius: 3px;
}

/* Bracket Visualization */
#bracket-container {
    min-height: 300px;
}

#bracket-container .card {
    transition: transform 0.2s, box-shadow 0.2s;
}

#bracket-container .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

#bracket-container .card.border-warning {
    border-width: 2px;
    border-color: var(--warning-color) !important;
}

#bracket-container .card.border-primary {
    border-width: 2px;
    border-color: var(--primary-color) !important;
}

#bracket-container h5 {
    color: var(--dark-color);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1rem;
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
}

/* Bracket Match Cards */
.bracket-match {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

.bracket-team {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--dark-color);
}

.bracket-vs {
    color: #6c757d;
    font-weight: 500;
    margin: 0.5rem 0;
}

.bracket-details {
    color: #6c757d;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}
