/* ==========================================================================
   DESIGN SYSTEM & VARIABLES (Colors: Orange, White, Light Gray, Black)
   ========================================================================== */
:root {
    /* Color Palette */
    --bg-darkest: #0a0a0c;      /* Deepest black background */
    --bg-dark: #121216;         /* Panel and container background */
    --bg-card: #1c1c24;         /* Player card background */
    --bg-card-selected: #242430;/* Active player background */
    
    --orange-primary: #ff6b00;  /* Main brand orange */
    --orange-hover: #ff8533;    /* Light orange for hover states */
    --orange-glow: rgba(255, 107, 0, 0.25);
    --orange-glow-strong: rgba(255, 107, 0, 0.5);
    
    --text-white: #ffffff;      /* Headers and primary text */
    --text-light-gray: #e2e8f0; /* Body text */
    --text-muted: #718096;      /* Secondary details and disabled states */
    
    --border-color: #2b2b36;    /* Card and divider borders */
    --border-focus: #ff6b00;    /* Focus outlines */
    
    /* Layout Constants */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-orange: 0 0 20px rgba(255, 107, 0, 0.35);
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-darkest);
    color: var(--text-light-gray);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ==========================================================================
   LAYOUT CONTAINERS
   ========================================================================== */
.app-container {
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
@media (min-width: 901px) {
    .app-container {
        padding: 24px 16px;
        gap: 24px;
    }
}

/* ==========================================================================
   HEADER (Optimized & Compact)
   ========================================================================== */
.app-header {
    text-align: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.logo-container {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--orange-primary);
    background-color: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-orange);
    transition: transform var(--transition-normal);
}

.logo-container:hover {
    transform: rotate(5deg) scale(1.05);
}

.team-logo {
    width: 110%;
    height: 110%;
    object-fit: cover;
}

.header-text {
    text-align: left;
    display: flex;
    flex-direction: column;
}

.team-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.1;
}

.team-subtitle {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--orange-primary);
    text-transform: uppercase;
    margin-top: 2px;
}

/* ==========================================================================
   MOBILE TABS (Segmented Control style)
   ========================================================================== */
.mobile-tabs {
    display: none; /* Desktop hidden */
    background-color: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    width: 100%;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.tab-button {
    flex: 1;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 10px 6px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-button.active {
    background-color: var(--orange-primary);
    border-color: var(--orange-primary);
    color: var(--text-white);
    box-shadow: var(--shadow-orange);
}

.tab-badge {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* ==========================================================================
   MAIN DASHBOARD PANELS
   ========================================================================== */
.app-main {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
    flex: 1;
}

@media (max-width: 900px) {
    .mobile-tabs {
        display: flex;
    }
    .app-main {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0;
    }
    .panel {
        display: none !important; /* Hide inactive panels on mobile */
        border: none !important;
        border-radius: 0 !important;
        background-color: var(--bg-darkest) !important;
        padding: 12px !important; /* Thinner padding on mobile */
    }
    .panel.active {
        display: flex !important; /* Show active panel on mobile */
    }
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .bulk-actions {
        display: flex;
        width: 100%;
        gap: 8px;
    }
    .bulk-actions button {
        flex: 1;
        font-size: 0.75rem;
        padding: 8px 12px;
    }
    .players-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important; /* Force exact 2 columns */
        gap: 8px !important;
        width: 100%;
    }
}

.panel {
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: var(--shadow-md);
}

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

.panel-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-white);
}

.player-counter {
    background-color: rgba(255, 107, 0, 0.1);
    color: var(--orange-primary);
    border: 1px solid rgba(255, 107, 0, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ==========================================================================
   CONTROLS, SEARCH & BULK ACTIONS
   ========================================================================== */
.search-and-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 12px 12px 12px 42px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-white);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--orange-primary);
    box-shadow: 0 0 0 2px var(--orange-glow);
}

.bulk-actions {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 10px 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-light-gray);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: #262632;
    border-color: var(--text-muted);
    color: var(--text-white);
}

.btn-primary {
    background-color: var(--orange-primary);
    color: var(--text-white);
    box-shadow: var(--shadow-orange);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--orange-hover);
    box-shadow: 0 0 25px var(--orange-glow-strong);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ==========================================================================
   PLAYERS LIST (Compact Pills)
   ========================================================================== */
.players-list-container {
    overflow-y: auto;
    max-height: 480px;
    padding-right: 4px;
}

.players-grid {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.player-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    min-width: 0; /* crucial for ellipsis */
}

.player-item:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 107, 0, 0.4);
}

.player-item.selected {
    background-color: var(--bg-card-selected);
    border-color: var(--orange-primary);
    box-shadow: 0 2px 8px var(--orange-glow);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.player-checkbox {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.player-item.selected .player-checkbox {
    background-color: var(--orange-primary);
    border-color: var(--orange-primary);
}

.player-checkbox svg {
    width: 8px;
    height: 8px;
    color: var(--text-white);
    display: none;
}

.player-item.selected .player-checkbox svg {
    display: block;
}

.player-name {
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--text-light-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-item.selected .player-name {
    color: var(--text-white);
    font-weight: 600;
}

.stars-display {
    display: inline-flex;
    align-items: center;
    background-color: rgba(255, 107, 0, 0.1);
    border: 1px solid rgba(255, 107, 0, 0.2);
    padding: 1px 6px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--orange-primary);
}

/* ==========================================================================
   ADD AVULSO (TEMPORARY PLAYERS) STYLE
   ========================================================================== */
.add-avulso-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: var(--bg-card);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px dashed rgba(255, 107, 0, 0.4);
    margin-top: 4px;
}

.add-avulso-box input {
    width: 100%;
    background-color: var(--bg-darkest);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-white);
    padding: 8px 10px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.add-avulso-box input:focus {
    border-color: var(--orange-primary);
}

.add-avulso-controls {
    display: flex;
    gap: 8px;
    width: 100%;
}

.avulso-rating-select {
    flex: 1;
}

.avulso-rating-select select {
    width: 100%;
    background-color: var(--bg-darkest);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--orange-primary);
    padding: 8px 10px;
    font-size: 0.85rem;
    font-weight: 700;
    outline: none;
    cursor: pointer;
}

.add-avulso-controls button {
    flex: 1.5;
    padding: 8px 12px;
    font-size: 0.85rem;
}

/* Delete badge for removing temporary players */
.delete-avulso-badge {
    color: var(--text-muted);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
    margin-left: 2px;
}

.delete-avulso-badge:hover {
    color: #ff3b30;
}

/* ==========================================================================
   DRAW PANEL CONFIGURATION
   ========================================================================== */
.draw-config-box {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.draw-preview-box {
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-light-gray);
    background-color: var(--bg-darkest);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--orange-primary);
}

.draw-preview-highlight {
    color: var(--orange-primary);
    font-weight: 700;
}

.btn-draw {
    height: 48px;
    font-size: 1rem;
    font-weight: 700;
    width: 100%;
}

.icon {
    width: 20px;
    height: 20px;
}

/* Spin animation for Shuffle/Draw icon on hover */
.icon-spin-hover {
    transition: transform var(--transition-normal);
}
.btn-draw:hover .icon-spin-hover {
    transform: rotate(180deg);
}

/* ==========================================================================
   RESULTS SECTION
   ========================================================================== */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeIn var(--transition-normal) forwards;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.results-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    color: var(--text-white);
}

.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.team-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.team-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--orange-primary);
}

.team-card:hover {
    box-shadow: var(--shadow-md);
}

.team-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.team-card-header h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-white);
}

.team-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.team-stars-total {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--orange-primary);
    background-color: rgba(255, 107, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.team-players-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-player-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.team-player-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.team-player-row.swap-selected {
    background-color: rgba(255, 107, 0, 0.15) !important;
    border-color: var(--orange-primary) !important;
    box-shadow: 0 0 10px var(--orange-glow) !important;
}

.team-player-name {
    font-weight: 500;
    color: var(--text-light-gray);
}

.team-player-stars {
    font-size: 0.75rem;
    color: var(--orange-primary);
    display: flex;
    align-items: center;
    gap: 2px;
}

/* ==========================================================================
   TACTICAL SOCCER BOARD (Stylized: Gray, Orange, White, Black - NO green)
   ========================================================================== */
.tactical-board-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.tactical-board-section h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    color: var(--text-white);
}

.soccer-field {
    width: 100%;
    aspect-ratio: 16 / 10;
    background-color: var(--bg-card); /* Dark gray field background */
    border: 2px solid var(--border-color); /* Light gray boundary border */
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 0;
}

/* Field lines using light grays */
.field-line {
    position: absolute;
    pointer-events: none;
    border: 1px solid rgba(226, 232, 240, 0.15); /* Semi-transparent white-gray */
}

.center-line {
    top: 50%;
    left: 0;
    width: 100%;
    height: 0;
    transform: translateY(-50%);
}

.center-circle {
    top: 50%;
    left: 50%;
    width: 16%;
    aspect-ratio: 1;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.penalty-area {
    width: 35%;
    height: 15%;
    left: 32.5%;
}

.area-top {
    top: 0;
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.area-bottom {
    bottom: 0;
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* ==========================================================================
   RESERVAS SECTION
   ========================================================================== */
.reservas-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 10px;
    box-shadow: var(--shadow-sm);
}

.reservas-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    color: var(--orange-primary);
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reservas-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.reserve-badge {
    background-color: var(--bg-darkest);
    border: 1px solid var(--border-color);
    color: var(--text-light-gray);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reserve-stars {
    color: var(--orange-primary);
    font-size: 0.75rem;
    font-weight: bold;
}

/* Team player placements on tactical field */
.team-field-half {
    position: absolute;
    width: 100%;
    height: 48%;
}

.top-half {
    top: 0;
}

.bottom-half {
    bottom: 0;
}

/* Tactical Player Badge */
.field-player-badge {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.player-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    border: 2px solid var(--text-white);
    color: var(--text-white);
    transition: transform var(--transition-fast);
}

/* GK Goalkeeper specific styling */
.player-circle.gk-circle {
    border-style: dashed;
    border-color: var(--text-muted);
    background-color: transparent !important;
    color: var(--text-muted) !important;
    font-weight: 500;
}

/* Alternating colors for Teams in the tactical board */
.top-half .player-circle {
    background-color: var(--bg-darkest);
    border-color: var(--orange-primary);
}

.bottom-half .player-circle {
    background-color: var(--orange-primary);
    border-color: var(--text-white);
    color: var(--bg-darkest);
}

/* Positions mapping (absolute percentages) */
.top-half .pos-gk { top: 5%; left: 50%; transform: translateX(-50%); }
.top-half .pos-df { top: 25%; left: 50%; transform: translateX(-50%); }
.top-half .pos-lm { top: 55%; left: 12%; }
.top-half .pos-rm { top: 55%; right: 12%; }
.top-half .pos-lf { top: 78%; left: 30%; }
.top-half .pos-rf { top: 78%; right: 30%; }

.bottom-half .pos-gk { bottom: 5%; left: 50%; transform: translateX(-50%); }
.bottom-half .pos-df { bottom: 25%; left: 50%; transform: translateX(-50%); }
.bottom-half .pos-lm { bottom: 55%; left: 12%; }
.bottom-half .pos-rm { bottom: 55%; right: 12%; }
.bottom-half .pos-lf { bottom: 78%; left: 30%; }
.bottom-half .pos-rf { bottom: 78%; right: 30%; }

.field-player-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-white);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
    background-color: rgba(10, 10, 12, 0.7);
    padding: 1px 5px;
    border-radius: 3px;
    max-width: 75px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app-footer {
    text-align: center;
    padding: 20px 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* ==========================================================================
   NOTIFICATIONS / TOAST
   ========================================================================== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: #1a1a24;
    border: 1px solid var(--orange-primary);
    color: var(--text-white);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md), var(--shadow-orange);
    z-index: 1000;
    font-weight: 600;
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.6);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.shuffle-animating {
    animation: shuffleFade 0.4s ease-in-out infinite alternate;
}

@keyframes shuffleFade {
    0% {
        opacity: 0.3;
        filter: blur(1px);
    }
    100% {
        opacity: 0.9;
        filter: blur(0px);
    }
}

/* ==========================================================================
   MANAGEMENT PANEL & ADMIN CONTROLS (Mobile First / Desktop Responsive)
   ========================================================================== */
.manage-panel {
    grid-column: span 2;
    display: none;
    animation: fadeIn var(--transition-normal);
}

.header-actions {
    margin-left: auto;
}

.btn-manage-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.sync-status {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
}

.status-loading {
    background-color: rgba(255, 165, 0, 0.15);
    color: #ffa500;
    border: 1px solid rgba(255, 165, 0, 0.3);
}

.status-connected {
    background-color: rgba(0, 200, 80, 0.15);
    color: #00c850;
    border: 1px solid rgba(0, 200, 80, 0.3);
}

.status-disconnected {
    background-color: rgba(255, 60, 60, 0.15);
    color: #ff3c3c;
    border: 1px solid rgba(255, 60, 60, 0.3);
}

.config-box-admin, .add-player-box-admin {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.config-box-admin h3, .add-player-box-admin h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-white);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.pantry-config-row, .add-player-row {
    display: flex;
    gap: 10px;
}

.pantry-config-row input, .add-player-row input {
    flex: 1;
    background-color: var(--bg-darkest);
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: border-color var(--transition-fast);
}

.pantry-config-row input:focus, .add-player-row input:focus {
    border-color: var(--border-focus);
    outline: none;
}

.add-player-row select {
    background-color: var(--bg-darkest);
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.help-text a {
    color: var(--orange-primary);
    text-decoration: none;
}

.help-text a:hover {
    text-decoration: underline;
}

.manage-players-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.manage-players-list-header {
    display: grid;
    grid-template-columns: 1fr 100px 80px;
    padding: 10px 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.manage-players-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.manage-player-item {
    display: grid;
    grid-template-columns: 1fr 100px 80px;
    align-items: center;
    padding: 8px 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
}

.manage-player-item:hover {
    background-color: var(--bg-card-selected);
}

.manage-player-item input {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-white);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 6px;
    border-radius: var(--radius-sm);
    width: 90%;
}

.manage-player-item input:focus {
    background: var(--bg-darkest);
    border-color: var(--border-focus);
    outline: none;
}

.manage-player-item select {
    background-color: var(--bg-darkest);
    border: 1px solid var(--border-color);
    color: var(--orange-primary);
    padding: 6px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    width: 80px;
}

.btn-delete-player {
    background: rgba(255, 60, 60, 0.1);
    border: 1px solid rgba(255, 60, 60, 0.2);
    color: #ff3c3c;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-delete-player:hover {
    background-color: #ff3c3c;
    color: var(--text-white);
    transform: scale(1.05);
}

.manage-actions-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.manage-actions-footer .btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Scrollbar styling for player list */
.manage-players-list::-webkit-scrollbar {
    width: 6px;
}

.manage-players-list::-webkit-scrollbar-track {
    background: var(--bg-darkest);
}

.manage-players-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.manage-players-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

@media (max-width: 900px) {
    .manage-players-list-header {
        grid-template-columns: 1fr 90px 50px;
        font-size: 0.75rem;
    }
    .manage-player-item {
        grid-template-columns: 1fr 90px 50px;
        padding: 6px 10px;
    }
    .manage-player-item input {
        font-size: 0.85rem;
    }
    .manage-player-item select {
        width: 70px;
        font-size: 0.8rem;
    }
    .pantry-config-row, .add-player-row {
        flex-direction: column;
    }
    .pantry-config-row button, .add-player-row button {
        width: 100%;
        padding: 12px;
    }
    .header-actions {
        display: none; /* Hide header gear button on mobile since we have a dedicated bottom tab */
    }
}
