:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --bg-modal: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --primary-light: #eff6ff;
    /* Light blue for backgrounds */
    --primary-header: #0284c7;
    /* Darker blue for text on light backgrounds */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    margin: 0;
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 72px;
    background: #ffffff;
    /* border-right: 1px solid var(--border); */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 16px;
    flex-shrink: 0;
    height: 100vh;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-logo {
    width: 42px;
    height: auto;
    margin-bottom: 24px;
    cursor: pointer;
}

.nav-divider {
    width: 40px;
    height: 1px;
    background: #f0f0f0;
    margin: 4px 0;
}

.nav-item {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #111827;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item:hover {
    background: #f3f4f6;
    color: #000;
}

.nav-item.active-blue {
    background: var(--primary);
    /* CKRAS Blue */
    color: white;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.nav-item.play-btn {
    background: #000;
    color: #fff;
    border-radius: 50%;
}


/* Main Content */
.main-content {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
}

.breadcrumb {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
    display: inline-block;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 32px 0;
}

/* Design System - Inputs */
.input-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 16px;
    transition: box-shadow 0.2s;
}

.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.input-field {
    width: 100%;
    border: none;
    outline: none;
    font-size: 15px;
    color: var(--text-main);
    background: transparent;
    font-family: inherit;
    padding: 0;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

/* Header style for cards, often used for Teams */
.card-header-blue {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Server Header */
.server-header {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 32px;
}

.server-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 12px;
    display: grid;
    place-items: center;
}

.server-info h2 {
    margin: 0 0 4px 0;
    font-size: 20px;
}

.server-meta {
    font-size: 13px;
    color: var(--text-muted);
}

.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    margin-right: 4px;
}

.btn-primary {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 10px 24px;
    border-radius: 99px;
    /* Pill shape */
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--primary);
    color: white;
}

/* Tokens / List Items */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 12px;
}

.list-item-content {
    font-size: 13px;
    font-family: monospace;
}

.btn-text-danger {
    color: #ef4444;
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-text-action {
    color: var(--primary);
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Modal Styles - Standardized */
.modal-overlay {
    background: rgba(0, 0, 0, 0.5);
    /* Slightly lighter than before */
    backdrop-filter: blur(2px);
    /* Modern touch */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-modal);
    color: var(--text-main);
    padding: 24px;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

/* UX Refinement Utilities */
.lineup-card-body {
    padding: 16px;
    min-height: 320px;
    /* Ensure equal height for lineups */
    display: flex;
    flex-direction: column;
}

.header-actions-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.action-group-primary {
    display: flex;
    gap: 8px;
}

.action-group-secondary {
    display: flex;
    gap: 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.action-group-secondary:hover {
    opacity: 1;
}

.team-logo-placeholder {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.badge-live {
    background: #ef4444;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    animation: pulse-red 2s infinite;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ... existing code ... */

/* Unified Edit Modal Styles */
.modal-split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Two equal columns */
    gap: 24px;
    height: 600px;
    /* Fixed height for scrollable areas */
}

.modal-col {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* For internal scrolling */
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f9fafb;
}

.modal-col-header {
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-col-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-slot {
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}

.player-slot:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.player-slot.empty {
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--text-muted);
    justify-content: center;
    cursor: pointer;
    opacity: 0.7;
}

.player-slot.empty:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: white;
    opacity: 1;
}

.spectator-section {
    grid-column: 1 / -1;
    /* Span full width bottom */
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 0;
}

/* Address Book List Item */
.ab-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.ab-item:hover {
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ab-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: bold;
    color: #6b7280;
}

@media (max-width: 768px) {
    .modal-split-view {
        grid-template-columns: 1fr;
        height: auto;
        max-height: 80vh;
        overflow-y: auto;
    }

    .modal-col {
        height: 300px;
    }
}

/* Mobile Header */
.mobile-header {
    display: none;
    background: #fff;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 101;
    /* Higher than sidebar if needed, but we overlay */
}

.mobile-menu-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-main);
}

/* New Mobile Navigation Overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 60px;
    /* Below header */
    left: 0;
    width: 100%;
    height: calc(100vh - 60px);
    background: white;
    z-index: 100;
    flex-direction: column;
    padding: 24px;
    box-sizing: border-box;
    gap: 16px;
}

.mobile-nav-overlay.open {
    display: flex;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s;
}

.mobile-nav-link:hover {
    background: #f9fafb;
    color: var(--primary);
}

.mobile-nav-link svg {
    color: var(--text-muted);
}

.mobile-nav-link:hover svg {
    color: var(--primary);
}


@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        display: none;
        /* Sidebar is completely hidden on mobile now, replaced by overlay */
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        padding: 20px;
    }

    /* Stack flex containers on mobile */
    .card[style*="display:flex"] {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .match-item {
        display: flex;
        flex-direction: column;
        gap: 12px;
        position: relative;
    }

    /* Make Team Name bigger and at the top */
    .match-item span:nth-child(3) {
        order: -2;
        font-size: 16px;
        font-weight: 700 !important;
        margin-bottom: 4px;
    }

    /* Meta info row */
    .match-item .badge {
        display: inline-block;
        width: fit-content;
        margin-right: 8px;
    }

    .match-item .mode-badge {
        display: inline-block;
        margin-right: 8px;
    }

    .match-item span[style*="text-align:right"] {
        text-align: left !important;
        color: var(--text-muted);
        font-size: 12px;
        order: 10;
        /* Time at the bottom */
        margin-top: 4px;
        border-top: 1px solid #f3f4f6;
        padding-top: 8px;
        width: 100%;
    }

    .user-section {
        flex-direction: column;
        text-align: center;
    }

    .server-header {
        flex-direction: column;
        text-align: center;
    }
}