All files / src/components/live LiveAdminControls.vue

0% Statements 0/520
0% Branches 0/1
0% Functions 0/1
0% Lines 0/520

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
<template>
  <div class="admin-controls">
    <!-- Lineup Section (collapsible) -->
    <div class="lineup-section">
      <button
        @click="toggleLineupSection"
        class="section-toggle"
        :class="{ expanded: showLineupSection }"
      >
        <span class="toggle-icon">{{ showLineupSection ? '-' : '+' }}</span>
        Lineup
      </button>
 
      <div v-if="showLineupSection" class="lineup-content">
        <!-- Team tabs -->
        <div class="team-tabs">
          <button
            @click="activeLineupTab = 'home'"
            :class="['tab-button', { active: activeLineupTab === 'home' }]"
          >
            {{ matchState.home_team_name }}
          </button>
          <button
            @click="activeLineupTab = 'away'"
            :class="['tab-button', { active: activeLineupTab === 'away' }]"
          >
            {{ matchState.away_team_name }}
          </button>
        </div>
 
        <!-- Lineup manager for selected team -->
        <div v-if="lineupsLoading" class="lineup-loading">
          Loading lineups...
        </div>
        <LineupManager
          v-else-if="activeLineupTab === 'home'"
          :team-id="matchState.home_team_id"
          :team-name="matchState.home_team_name"
          :roster="homeRoster"
          :initial-lineup="homeLineup"
          :saving="savingLineup"
          :sport-type="sportType"
          @save="handleSaveLineup(matchState.home_team_id, $event)"
        />
        <LineupManager
          v-else
          :team-id="matchState.away_team_id"
          :team-name="matchState.away_team_name"
          :roster="awayRoster"
          :initial-lineup="awayLineup"
          :saving="savingLineup"
          :sport-type="sportType"
          @save="handleSaveLineup(matchState.away_team_id, $event)"
        />
      </div>
    </div>
 
    <!-- Clock Controls -->
    <div class="clock-controls">
      <button
        v-if="matchPeriod === 'Not Started'"
        @click="showStartModal = true"
        class="control-button start"
      >
        Start Match
      </button>
 
      <button
        v-if="matchPeriod === '1st Half'"
        @click="$emit('update-clock', 'start_halftime')"
        class="control-button halftime"
      >
        Halftime
      </button>
 
      <button
        v-if="matchPeriod === 'Halftime'"
        @click="$emit('update-clock', 'start_second_half')"
        class="control-button start"
      >
        Start 2nd Half
      </button>
 
      <button
        v-if="matchPeriod === '2nd Half'"
        @click="$emit('update-clock', 'end_match')"
        class="control-button end"
      >
        End Match
      </button>
    </div>
 
    <!-- Goal & Card Buttons - only when clock is running (1st or 2nd half) -->
    <div
      v-if="matchPeriod === '1st Half' || matchPeriod === '2nd Half'"
      class="goal-controls"
    >
      <button @click="showGoalModal = true" class="control-button goal">
        + Goal
      </button>
      <button @click="showCardModal = true" class="control-button card">
        + Card
      </button>
    </div>
 
    <!-- Goal Modal -->
    <div
      v-if="showGoalModal"
      class="modal-overlay"
      @click.self="closeGoalModal"
    >
      <div class="modal-content">
        <h3 class="modal-title">Record Goal</h3>
 
        <div class="form-group">
          <label>Team</label>
          <div class="team-selector">
            <button
              @click="selectTeam(matchState.home_team_id)"
              :class="[
                'team-button',
                { selected: goalTeamId === matchState.home_team_id },
              ]"
            >
              {{ matchState.home_team_name }}
            </button>
            <button
              @click="selectTeam(matchState.away_team_id)"
              :class="[
                'team-button',
                { selected: goalTeamId === matchState.away_team_id },
              ]"
            >
              {{ matchState.away_team_name }}
            </button>
          </div>
        </div>
 
        <div class="form-group">
          <label for="player-select">Goal Scorer</label>
          <div v-if="rostersLoading" class="roster-loading">
            Loading roster...
          </div>
          <select
            v-else-if="currentTeamRoster.length > 0"
            id="player-select"
            v-model="selectedPlayerId"
            class="player-select"
          >
            <option :value="null">Select player...</option>
            <option
              v-for="player in currentTeamRoster"
              :key="player.id"
              :value="player.id"
            >
              {{ formatPlayerOption(player) }}
            </option>
            <option value="other">Other (type name)</option>
          </select>
          <div v-else class="no-roster-message">No roster available</div>
          <!-- Fallback text input when "Other" is selected or no roster -->
          <input
            v-if="
              selectedPlayerId === 'other' || currentTeamRoster.length === 0
            "
            v-model="goalPlayerName"
            type="text"
            placeholder="Enter player name"
            class="text-input mt-2"
          />
        </div>
 
        <div class="form-group">
          <label for="goal-message">Description (optional)</label>
          <input
            id="goal-message"
            v-model="goalMessage"
            type="text"
            placeholder="e.g., Header from corner"
            class="text-input"
          />
        </div>
 
        <div class="modal-actions">
          <button @click="closeGoalModal" class="cancel-button">Cancel</button>
          <button
            @click="submitGoal"
            :disabled="!canSubmitGoal"
            class="submit-button"
          >
            Record Goal
          </button>
        </div>
      </div>
    </div>
 
    <!-- Start Match Modal -->
    <div
      v-if="showStartModal"
      class="modal-overlay"
      @click.self="showStartModal = false"
    >
      <div class="modal-content">
        <h3 class="modal-title">Start Match</h3>
 
        <div class="form-group">
          <label>Half Duration (minutes)</label>
          <div class="duration-presets">
            <button
              @click="selectedDuration = 35"
              :class="['preset-button', { selected: selectedDuration === 35 }]"
            >
              35 (U13)
            </button>
            <button
              @click="selectedDuration = 40"
              :class="['preset-button', { selected: selectedDuration === 40 }]"
            >
              40 (U14-15)
            </button>
            <button
              @click="selectedDuration = 45"
              :class="['preset-button', { selected: selectedDuration === 45 }]"
            >
              45 (U16+)
            </button>
          </div>
          <div class="duration-input-row">
            <input
              v-model.number="selectedDuration"
              type="number"
              min="20"
              max="60"
              class="duration-input"
            />
            <span class="duration-label"
              >min/half = {{ selectedDuration * 2 }} min total</span
            >
          </div>
        </div>
 
        <div class="modal-actions">
          <button @click="showStartModal = false" class="cancel-button">
            Cancel
          </button>
          <button
            @click="startMatch"
            :disabled="selectedDuration < 20 || selectedDuration > 60"
            class="submit-button"
          >
            Start Match
          </button>
        </div>
      </div>
    </div>
    <!-- Card Modal -->
    <div
      v-if="showCardModal"
      class="modal-overlay"
      @click.self="closeCardModal"
    >
      <div class="modal-content">
        <h3 class="modal-title">Record Card</h3>
 
        <div class="form-group">
          <label>Team</label>
          <div class="team-selector">
            <button
              @click="selectCardTeam(matchState.home_team_id)"
              :class="[
                'team-button',
                { selected: cardTeamId === matchState.home_team_id },
              ]"
            >
              {{ matchState.home_team_name }}
            </button>
            <button
              @click="selectCardTeam(matchState.away_team_id)"
              :class="[
                'team-button',
                { selected: cardTeamId === matchState.away_team_id },
              ]"
            >
              {{ matchState.away_team_name }}
            </button>
          </div>
        </div>
 
        <div class="form-group">
          <label>Card Type</label>
          <div class="team-selector">
            <button
              @click="selectedCardType = 'yellow_card'"
              :class="[
                'team-button card-yellow',
                { selected: selectedCardType === 'yellow_card' },
              ]"
            >
              Yellow
            </button>
            <button
              @click="selectedCardType = 'red_card'"
              :class="[
                'team-button card-red',
                { selected: selectedCardType === 'red_card' },
              ]"
            >
              Red
            </button>
          </div>
        </div>
 
        <div class="form-group">
          <label for="card-player-select">Player</label>
          <div v-if="rostersLoading" class="roster-loading">
            Loading roster...
          </div>
          <select
            v-else-if="cardTeamRoster.length > 0"
            id="card-player-select"
            v-model="cardPlayerId"
            class="player-select"
          >
            <option :value="null">Select player...</option>
            <option
              v-for="player in cardTeamRoster"
              :key="player.id"
              :value="player.id"
            >
              {{ formatPlayerOption(player) }}
            </option>
          </select>
          <div v-else class="no-roster-message">No roster available</div>
        </div>
 
        <div class="form-group">
          <label for="card-message">Reason (optional)</label>
          <input
            id="card-message"
            v-model="cardMessage"
            type="text"
            placeholder="e.g., Dangerous tackle"
            class="text-input"
          />
        </div>
 
        <div class="modal-actions">
          <button @click="closeCardModal" class="cancel-button">Cancel</button>
          <button
            @click="submitCard"
            :disabled="!canSubmitCard"
            class="submit-button"
            :class="
              selectedCardType === 'red_card' ? 'submit-red' : 'submit-yellow'
            "
          >
            Record Card
          </button>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script setup>
import { ref, computed, watch } from 'vue';
import LineupManager from './LineupManager.vue';
 
const props = defineProps({
  matchState: {
    type: Object,
    required: true,
  },
  matchPeriod: {
    type: String,
    required: true,
  },
  fetchRosters: {
    type: Function,
    default: null,
  },
  fetchLineups: {
    type: Function,
    default: null,
  },
  saveLineup: {
    type: Function,
    default: null,
  },
  homeLineup: {
    type: Object,
    default: null,
  },
  awayLineup: {
    type: Object,
    default: null,
  },
  sportType: {
    type: String,
    default: 'soccer',
  },
});
 
const emit = defineEmits(['update-clock', 'post-goal', 'post-card']);
 
// Goal modal state
const showGoalModal = ref(false);
const goalTeamId = ref(null);
const goalPlayerName = ref('');
const goalMessage = ref('');
const selectedPlayerId = ref(null);
 
// Roster state
const homeRoster = ref([]);
const awayRoster = ref([]);
const rostersLoading = ref(false);
const rostersLoaded = ref(false);
 
// Card modal state
const showCardModal = ref(false);
const cardTeamId = ref(null);
const cardPlayerId = ref(null);
const selectedCardType = ref('yellow_card');
const cardMessage = ref('');
 
// Start match modal state
const showStartModal = ref(false);
 
// Lineup section state
const showLineupSection = ref(false);
const activeLineupTab = ref('home');
const lineupsLoading = ref(false);
const lineupsLoaded = ref(false);
const savingLineup = ref(false);
 
// Toggle lineup section
function toggleLineupSection() {
  showLineupSection.value = !showLineupSection.value;
 
  // Load rosters and lineups when section is opened for the first time
  if (showLineupSection.value && !lineupsLoaded.value) {
    loadLineupsAndRosters();
  }
}
 
// Load lineups and rosters
async function loadLineupsAndRosters() {
  lineupsLoading.value = true;
  try {
    // Load rosters if not already loaded
    if (props.fetchRosters && !rostersLoaded.value) {
      const rosters = await props.fetchRosters();
      homeRoster.value = rosters.home || [];
      awayRoster.value = rosters.away || [];
      rostersLoaded.value = true;
    }
 
    // Load lineups
    if (props.fetchLineups) {
      await props.fetchLineups();
    }
 
    lineupsLoaded.value = true;
  } catch (err) {
    console.error('Failed to load lineups and rosters:', err);
  } finally {
    lineupsLoading.value = false;
  }
}
 
// Handle lineup save
async function handleSaveLineup(teamId, lineupData) {
  if (!props.saveLineup) return;
 
  savingLineup.value = true;
  try {
    const result = await props.saveLineup(
      teamId,
      lineupData.formation_name,
      lineupData.positions
    );
 
    if (!result.success) {
      console.error('Failed to save lineup:', result.error);
    }
  } catch (err) {
    console.error('Error saving lineup:', err);
  } finally {
    savingLineup.value = false;
  }
}
 
// Compute current team roster based on selected team
const currentTeamRoster = computed(() => {
  if (!goalTeamId.value) return [];
  if (goalTeamId.value === props.matchState.home_team_id) {
    return homeRoster.value;
  }
  return awayRoster.value;
});
 
// Compute whether goal can be submitted
const canSubmitGoal = computed(() => {
  if (!goalTeamId.value) return false;
  // If a player is selected from roster
  if (selectedPlayerId.value && selectedPlayerId.value !== 'other') return true;
  // If "Other" or no roster, need a player name
  if (goalPlayerName.value.trim()) return true;
  return false;
});
 
// Compute default duration based on age group
const defaultDuration = computed(() => {
  const ageGroup = props.matchState?.age_group_name?.toLowerCase() || '';
  if (ageGroup.includes('u13') || ageGroup.includes('u-13')) return 35;
  if (ageGroup.includes('u14') || ageGroup.includes('u-14')) return 40;
  if (ageGroup.includes('u15') || ageGroup.includes('u-15')) return 40;
  // U16, U17, U19 and default
  return 45;
});
 
const selectedDuration = ref(defaultDuration.value);
 
// Update selected duration when modal opens (in case age group wasn't loaded initially)
watch(showStartModal, newVal => {
  if (newVal) {
    selectedDuration.value = defaultDuration.value;
  }
});
 
// Load rosters when card modal opens
watch(showCardModal, async newVal => {
  if (newVal && props.fetchRosters && !rostersLoaded.value) {
    rostersLoading.value = true;
    try {
      const rosters = await props.fetchRosters();
      homeRoster.value = rosters.home || [];
      awayRoster.value = rosters.away || [];
      rostersLoaded.value = true;
    } catch (err) {
      console.error('Failed to load rosters:', err);
    } finally {
      rostersLoading.value = false;
    }
  }
});
 
// Load rosters when goal modal opens
watch(showGoalModal, async newVal => {
  if (newVal && props.fetchRosters && !rostersLoaded.value) {
    rostersLoading.value = true;
    try {
      const rosters = await props.fetchRosters();
      homeRoster.value = rosters.home || [];
      awayRoster.value = rosters.away || [];
      rostersLoaded.value = true;
    } catch (err) {
      console.error('Failed to load rosters:', err);
    } finally {
      rostersLoading.value = false;
    }
  }
});
 
// Handle team selection
function selectTeam(teamId) {
  goalTeamId.value = teamId;
  // Reset player selection when team changes
  selectedPlayerId.value = null;
  goalPlayerName.value = '';
}
 
// Close goal modal and reset state
function closeGoalModal() {
  showGoalModal.value = false;
  goalTeamId.value = null;
  selectedPlayerId.value = null;
  goalPlayerName.value = '';
  goalMessage.value = '';
}
 
function startMatch() {
  emit('update-clock', {
    action: 'start_first_half',
    half_duration: selectedDuration.value,
  });
  showStartModal.value = false;
}
 
// Format player option for dropdown - avoid showing "#33 #33" for unlinked players
function formatPlayerOption(player) {
  const jerseyNum = player.jersey_number;
  const displayName = player.display_name;
 
  // If display_name is empty, null, or just the jersey number (with or without #), show only jersey number
  if (
    !displayName ||
    displayName === `#${jerseyNum}` ||
    displayName === String(jerseyNum)
  ) {
    return `#${jerseyNum}`;
  }
 
  return `#${jerseyNum} ${displayName}`;
}
 
// Card modal computed and functions
const cardTeamRoster = computed(() => {
  if (!cardTeamId.value) return [];
  if (cardTeamId.value === props.matchState.home_team_id) {
    return homeRoster.value;
  }
  return awayRoster.value;
});
 
const canSubmitCard = computed(() => {
  return cardTeamId.value && cardPlayerId.value && selectedCardType.value;
});
 
function selectCardTeam(teamId) {
  cardTeamId.value = teamId;
  cardPlayerId.value = null;
}
 
function closeCardModal() {
  showCardModal.value = false;
  cardTeamId.value = null;
  cardPlayerId.value = null;
  selectedCardType.value = 'yellow_card';
  cardMessage.value = '';
}
 
function submitCard() {
  if (!canSubmitCard.value) return;
 
  emit('post-card', {
    teamId: cardTeamId.value,
    playerId: cardPlayerId.value,
    cardType: selectedCardType.value,
    message: cardMessage.value.trim() || null,
  });
 
  closeCardModal();
}
 
function submitGoal() {
  if (!canSubmitGoal.value) return;
 
  // Determine player info to send
  let playerId = null;
  let playerName = null;
 
  if (selectedPlayerId.value && selectedPlayerId.value !== 'other') {
    // Player selected from roster
    playerId = selectedPlayerId.value;
    // Find player name for display
    const player = currentTeamRoster.value.find(p => p.id === playerId);
    playerName = player?.display_name || `#${player?.jersey_number}`;
  } else {
    // Manual entry
    playerName = goalPlayerName.value.trim();
  }
 
  emit('post-goal', {
    teamId: goalTeamId.value,
    playerName,
    playerId,
    message: goalMessage.value.trim() || null,
  });
 
  closeGoalModal();
}
</script>
 
<style scoped>
.admin-controls {
  padding: 12px 16px;
  background: #1e1e3f;
  border-bottom: 1px solid #333;
}
 
.clock-controls,
.goal-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}
 
.goal-controls {
  margin-top: 12px;
}
 
.control-button {
  flex: 1;
  max-width: 200px;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: background-color 0.2s;
}
 
.control-button.start {
  background: #4caf50;
  color: white;
}
 
.control-button.start:hover {
  background: #43a047;
}
 
.control-button.halftime {
  background: #ffc107;
  color: black;
}
 
.control-button.halftime:hover {
  background: #ffb300;
}
 
.control-button.end {
  background: #f44336;
  color: white;
}
 
.control-button.end:hover {
  background: #e53935;
}
 
.control-button.goal {
  background: #2196f3;
  color: white;
}
 
.control-button.goal:hover {
  background: #1e88e5;
}
 
.control-button.card {
  background: #ff9800;
  color: white;
}
 
.control-button.card:hover {
  background: #f57c00;
}
 
/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
 
.modal-content {
  background: #1e1e3f;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
}
 
.modal-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 20px;
  text-align: center;
  color: white;
}
 
.form-group {
  margin-bottom: 16px;
}
 
.form-group label {
  display: block;
  font-size: 14px;
  color: #aaa;
  margin-bottom: 8px;
}
 
.team-selector {
  display: flex;
  gap: 8px;
}
 
.team-button {
  flex: 1;
  padding: 12px;
  border: 2px solid #444;
  border-radius: 8px;
  background: transparent;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 48px;
}
 
.team-button.selected {
  border-color: #2196f3;
  background: rgba(33, 150, 243, 0.2);
}
 
.duration-presets {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
 
.preset-button {
  flex: 1;
  padding: 10px 8px;
  border: 2px solid #444;
  border-radius: 8px;
  background: transparent;
  color: white;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}
 
.preset-button.selected {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.2);
}
 
.preset-button:hover:not(.selected) {
  border-color: #666;
}
 
.duration-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
 
.duration-input {
  width: 80px;
  padding: 12px;
  border: 2px solid #444;
  border-radius: 8px;
  background: #16213e;
  color: white;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  min-height: 48px;
}
 
.duration-input:focus {
  outline: none;
  border-color: #4caf50;
}
 
.duration-input::-webkit-inner-spin-button,
.duration-input::-webkit-outer-spin-button {
  opacity: 1;
}
 
.duration-label {
  color: #aaa;
  font-size: 14px;
}
 
.text-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #444;
  border-radius: 8px;
  background: #16213e;
  color: white;
  font-size: 16px;
  min-height: 48px;
}
 
.text-input:focus {
  outline: none;
  border-color: #2196f3;
}
 
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
 
.cancel-button,
.submit-button {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
}
 
.cancel-button {
  background: #444;
  color: white;
}
 
.submit-button {
  background: #4caf50;
  color: white;
}
 
.submit-button:disabled {
  background: #666;
  cursor: not-allowed;
}
 
.submit-button.submit-yellow {
  background: #f9a825;
  color: black;
}
 
.submit-button.submit-red {
  background: #d32f2f;
}
 
.team-button.card-yellow.selected {
  border-color: #f9a825;
  background: rgba(249, 168, 37, 0.2);
}
 
.team-button.card-red.selected {
  border-color: #d32f2f;
  background: rgba(211, 47, 47, 0.2);
}
 
/* Player selection styles */
.player-select {
  width: 100%;
  padding: 12px;
  border: 2px solid #444;
  border-radius: 8px;
  background: #16213e;
  color: white;
  font-size: 16px;
  min-height: 48px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23aaa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
 
.player-select:focus {
  outline: none;
  border-color: #2196f3;
}
 
.player-select option {
  background: #16213e;
  color: white;
  padding: 8px;
}
 
.roster-loading {
  color: #aaa;
  font-size: 14px;
  padding: 12px;
  text-align: center;
}
 
.no-roster-message {
  color: #888;
  font-size: 14px;
  padding: 8px 0;
}
 
.mt-2 {
  margin-top: 8px;
}
 
/* Lineup section styles */
.lineup-section {
  margin-bottom: 16px;
  border-bottom: 1px solid #333;
  padding-bottom: 16px;
}
 
.section-toggle {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: 2px solid #444;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
 
.section-toggle:hover {
  border-color: #666;
}
 
.section-toggle.expanded {
  border-color: #2196f3;
  background: rgba(33, 150, 243, 0.1);
}
 
.toggle-icon {
  font-size: 18px;
  font-weight: bold;
  width: 20px;
  text-align: center;
}
 
.lineup-content {
  margin-top: 16px;
}
 
.team-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
 
.tab-button {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid #444;
  border-radius: 8px;
  background: transparent;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
 
.tab-button.active {
  border-color: #2196f3;
  background: rgba(33, 150, 243, 0.2);
}
 
.tab-button:hover:not(.active) {
  border-color: #666;
}
 
.lineup-loading {
  text-align: center;
  padding: 40px;
  color: #aaa;
}
</style>