/* Modern Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-main: #f4f6f9;
    --bg-sidebar: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --primary-blue: #1e40af;
    --primary-light: #eff6ff;
    --accent-gold: #eab308;
    --accent-gold-light: #fef9c3;
    --border-color: #e2e8f0;
    --radius-lg: 12px;
    --radius-sm: 6px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* Master Layout Grid */
.dashboard-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: 400px;
    height: 100%;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: solid;
    flex-direction: column;
    z-index: 10;
    box-shadow: 4px 0 24px rgb(0 0 0 / 0.03);
}

.sidebar-header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo-tag {
    display: inline-block;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--primary-blue);
    background-color: var(--primary-light);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.ranking-title-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 12px 24px;
}

.ranking-title-area h2 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Live blinking indicator */
.live-indicator {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-indicator .dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Scroll Container for Competitors */
.scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Custom minimal scrollbar */
.scroll-container::-webkit-scrollbar {
    width: 6px;
}
.scroll-container::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

/* Competitor Cards */
.contestant-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.contestant-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: #cbd5e1;
}

/* Special styling for 1st place */
.contestant-card.leader {
    border-color: var(--accent-gold);
    background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%);
}

.contestant-card.leader .position-badge {
    background-color: var(--accent-gold);
    color: #ffffff;
}

/* Card layout elements */
.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.position-badge {
    font-size: 13px;
    font-weight: 700;
    background-color: var(--bg-main);
    color: var(--text-secondary);
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.boat-meta {
    flex: 1;
}

.boat-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.skipper-name {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 1px;
}

/* Horizontal Stat Layout inside Cards */
.contestant-details {
    display: grid;
    grid-template-columns: repeat(3, 15fr);
    gap: 8px;
    background-color: var(--bg-main);
    padding: 10px;
    border-radius: var(--radius-sm);
}

.stat-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.stat-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.speed-highlight {
    color: var(--primary-blue);
}

/* Map Screen Constraints */
.map-view {
    flex: 1;
    height: 100%;
    position: relative;
    background-color: #e5e7eb;
}

#map-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}