All files / src/components/profiles FanProfile.vue

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

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 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
<template>
  <!-- Edit Profile Modal -->
  <div
    v-if="showEditProfile"
    class="modal-overlay"
    @click.self="showEditProfile = false"
  >
    <div class="edit-modal">
      <div class="modal-header">
        <h3>Edit Profile</h3>
        <button class="close-btn" @click="showEditProfile = false">
          &times;
        </button>
      </div>
      <div class="modal-body">
        <div class="form-group">
          <label>Display Name</label>
          <input
            v-model="editForm.display_name"
            type="text"
            placeholder="Your display name"
          />
        </div>
        <div class="form-group">
          <label>Email</label>
          <input
            v-model="editForm.email"
            type="email"
            placeholder="your@email.com"
          />
        </div>
      </div>
      <div class="modal-footer">
        <button class="cancel-btn" @click="showEditProfile = false">
          Cancel
        </button>
        <button class="save-btn" @click="saveProfile" :disabled="saving">
          {{ saving ? 'Saving...' : 'Save Changes' }}
        </button>
      </div>
    </div>
  </div>
 
  <div class="fan-dashboard">
    <!-- Hero Card with Club/League Info -->
    <div class="hero-card" :style="heroCardStyle">
      <div class="hero-logo">
        <img
          v-if="club?.logo_url"
          :src="club.logo_url"
          :alt="club.name"
          class="club-logo-img"
        />
        <div v-else-if="club" class="club-logo-placeholder">
          <span>{{ (club?.name || 'C').charAt(0).toUpperCase() }}</span>
        </div>
        <div v-else class="league-logo-placeholder">
          <span>⚽</span>
        </div>
      </div>
      <div class="hero-info">
        <div class="club-name-row">
          <h2 class="club-name">{{ club?.name || 'League Fan' }}</h2>
          <span class="role-badge">{{ club ? 'Club Fan' : 'Fan' }}</span>
        </div>
 
        <div v-if="club?.city" class="location-line">{{ club.city }}</div>
 
        <div class="fan-info">
          <span class="fan-name">{{ displayName }}</span>
          <span class="separator">|</span>
          <span class="member-since">
            Member since {{ formatDate(authStore.state.profile?.created_at) }}
          </span>
        </div>
 
        <div class="hero-stats">
          <div class="hero-stat">
            <span class="stat-number">{{ clubTeams.length || '—' }}</span>
            <span class="stat-label">{{ club ? 'Club Teams' : 'Teams' }}</span>
          </div>
          <div class="hero-stat">
            <span class="stat-number">{{ upcomingMatchCount }}</span>
            <span class="stat-label">Upcoming</span>
          </div>
          <div class="hero-stat">
            <span class="stat-number">{{ followedTeam ? '1' : '0' }}</span>
            <span class="stat-label">Following</span>
          </div>
        </div>
 
        <div class="hero-actions">
          <button class="action-btn primary" @click="openEditProfile">
            Edit Profile
          </button>
        </div>
        <LiveUpdatesTeaser variant="hero" />
      </div>
    </div>
 
    <!-- Club Teams Section (for Club Fans) - Grouped by League > Division -->
    <div
      v-if="club && groupedTeams.length > 0"
      class="club-teams-section"
      :style="clubTeamsStyle"
    >
      <h3>{{ club.name }} Teams</h3>
      <div class="leagues-container">
        <div
          v-for="league in groupedTeams"
          :key="league.id"
          class="league-group"
        >
          <div class="league-header" :style="leagueHeaderStyle">
            <span class="league-icon">🏆</span>
            <span class="league-name">{{ league.name }}</span>
          </div>
          <div class="divisions-container">
            <div
              v-for="division in league.divisions"
              :key="division.id"
              class="division-group"
            >
              <div class="division-header" :style="divisionHeaderStyle">
                {{ division.name }}
              </div>
              <div class="age-groups-list">
                <div
                  v-for="ageGroup in division.ageGroups"
                  :key="ageGroup.id"
                  class="age-group-row"
                >
                  <span class="age-group-name">{{ ageGroup.name }}</span>
                  <div class="age-group-links">
                    <button
                      class="link-btn table-link"
                      :style="tableLinkStyle"
                      @click="
                        goToTableWithFilters(
                          ageGroup.id,
                          league.id,
                          division.id
                        )
                      "
                    >
                      Table
                    </button>
                    <button
                      class="link-btn matches-link"
                      :style="matchesLinkStyle"
                      @click="
                        goToMatchesWithFilters(
                          ageGroup.id,
                          league.id,
                          division.id
                        )
                      "
                    >
                      Matches
                    </button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
 
    <!-- Quick Access Section -->
    <div class="quick-access-section">
      <h3>Quick Access</h3>
      <div class="quick-cards">
        <div class="quick-card" @click="goToStandings">
          <div class="quick-icon">📊</div>
          <div class="quick-content">
            <h4>League Standings</h4>
            <p>Check current league positions</p>
          </div>
          <div class="quick-arrow">&rarr;</div>
        </div>
 
        <div class="quick-card" @click="goToSchedule">
          <div class="quick-icon">📅</div>
          <div class="quick-content">
            <h4>Match Schedule</h4>
            <p>See upcoming fixtures</p>
          </div>
          <div class="quick-arrow">&rarr;</div>
        </div>
 
        <div class="quick-card" @click="goToTeams">
          <div class="quick-icon">👥</div>
          <div class="quick-content">
            <h4>All Teams</h4>
            <p>Explore team profiles</p>
          </div>
          <div class="quick-arrow">&rarr;</div>
        </div>
      </div>
    </div>
 
    <!-- Upcoming Matches -->
    <div v-if="upcomingMatches.length > 0" class="upcoming-section">
      <h3>Upcoming Matches</h3>
      <div class="matches-list">
        <div
          v-for="match in upcomingMatches.slice(0, 5)"
          :key="match.id"
          class="match-card"
        >
          <div class="match-date">
            {{ formatMatchDate(match.game_date) }}
          </div>
          <div class="match-teams">
            <span class="home-team">{{ match.home_team_name }}</span>
            <span class="vs">vs</span>
            <span class="away-team">{{ match.away_team_name }}</span>
          </div>
          <div class="match-type">{{ match.match_type_name || 'League' }}</div>
        </div>
      </div>
    </div>
 
    <!-- Fan Features -->
    <div class="features-section">
      <h3>Fan Features</h3>
      <p class="section-description">
        As a {{ club ? club.name : 'league' }} fan, you have access to these
        features:
      </p>
      <div class="features-grid">
        <div class="feature-card">
          <div class="feature-icon">📊</div>
          <h4>Live Standings</h4>
          <p>Track league positions in real-time</p>
        </div>
 
        <div class="feature-card">
          <div class="feature-icon">📅</div>
          <h4>Full Schedule</h4>
          <p>Access all upcoming fixtures</p>
        </div>
 
        <div class="feature-card">
          <div class="feature-icon">⚽</div>
          <h4>Match Results</h4>
          <p>View scores and match details</p>
        </div>
 
        <div class="feature-card">
          <div class="feature-icon">👥</div>
          <h4>Team Profiles</h4>
          <p>Explore all teams in the league</p>
        </div>
      </div>
    </div>
    <LiveUpdatesSection />
  </div>
</template>
 
<script>
import { ref, reactive, computed, onMounted } from 'vue';
import { useAuthStore } from '@/stores/auth';
import { getApiBaseUrl } from '../../config/api';
import LiveUpdatesTeaser from './LiveUpdatesTeaser.vue';
import LiveUpdatesSection from './LiveUpdatesSection.vue';
 
export default {
  name: 'FanProfile',
  components: { LiveUpdatesTeaser, LiveUpdatesSection },
  emits: ['logout', 'navigate'],
  setup(props, { emit }) {
    const authStore = useAuthStore();
    const club = ref(null);
    const clubTeams = ref([]);
    const upcomingMatches = ref([]);
    const showEditProfile = ref(false);
    const saving = ref(false);
 
    const editForm = reactive({
      display_name: '',
      email: '',
    });
 
    const displayName = computed(() => {
      return (
        authStore.state.profile?.display_name ||
        authStore.state.profile?.username ||
        'Fan'
      );
    });
 
    const followedTeam = computed(() => {
      return authStore.state.profile?.team || null;
    });
 
    const upcomingMatchCount = computed(() => {
      return upcomingMatches.value.length;
    });
 
    const clubColors = computed(() => {
      return {
        primary: club.value?.primary_color || '#1e3a8a',
        secondary: club.value?.secondary_color || '#3b82f6',
      };
    });
 
    const heroCardStyle = computed(() => {
      return {
        background: `linear-gradient(135deg, ${clubColors.value.primary} 0%, ${clubColors.value.secondary} 100%)`,
      };
    });
 
    // Club-themed styles for the teams section
    const clubTeamsStyle = computed(() => {
      return {
        '--club-primary': clubColors.value.primary,
        '--club-secondary': clubColors.value.secondary,
      };
    });
 
    const leagueHeaderStyle = computed(() => {
      return {
        background: `linear-gradient(135deg, ${clubColors.value.primary} 0%, ${clubColors.value.secondary} 100%)`,
      };
    });
 
    const divisionHeaderStyle = computed(() => {
      // Lighter version of primary color for division headers
      return {
        background: `${clubColors.value.primary}15`,
        color: clubColors.value.primary,
        borderLeft: `3px solid ${clubColors.value.primary}`,
      };
    });
 
    const tableLinkStyle = computed(() => {
      return {
        background: `${clubColors.value.secondary}20`,
        color: clubColors.value.primary,
      };
    });
 
    const matchesLinkStyle = computed(() => {
      return {
        background: `${clubColors.value.primary}20`,
        color: clubColors.value.primary,
      };
    });
 
    // Group teams by League > Division > Age Groups
    const groupedTeams = computed(() => {
      const leagues = {};
 
      clubTeams.value.forEach(team => {
        const leagueId = team.leagues?.id || team.league_id;
        const leagueName =
          team.leagues?.name || team.league_name || 'Unknown League';
 
        if (!leagues[leagueId]) {
          leagues[leagueId] = {
            id: leagueId,
            name: leagueName,
            divisions: {},
          };
        }
 
        // Process team_mappings for division and age group info
        const mappings = team.team_mappings || [];
        mappings.forEach(mapping => {
          const divisionId = mapping.divisions?.id || mapping.division_id;
          const divisionName = mapping.divisions?.name || 'Unknown Division';
          const ageGroupId = mapping.age_groups?.id || mapping.age_group_id;
          const ageGroupName = mapping.age_groups?.name || 'Unknown';
 
          if (!divisionId) return;
 
          if (!leagues[leagueId].divisions[divisionId]) {
            leagues[leagueId].divisions[divisionId] = {
              id: divisionId,
              name: divisionName,
              ageGroups: {},
            };
          }
 
          if (
            ageGroupId &&
            !leagues[leagueId].divisions[divisionId].ageGroups[ageGroupId]
          ) {
            leagues[leagueId].divisions[divisionId].ageGroups[ageGroupId] = {
              id: ageGroupId,
              name: ageGroupName,
              leagueId: leagueId,
              divisionId: divisionId,
            };
          }
        });
      });
 
      // Convert to sorted array
      return Object.values(leagues)
        .map(league => ({
          ...league,
          divisions: Object.values(league.divisions)
            .map(division => ({
              ...division,
              ageGroups: Object.values(division.ageGroups).sort((a, b) =>
                a.name.localeCompare(b.name, undefined, { numeric: true })
              ),
            }))
            .sort((a, b) => a.name.localeCompare(b.name)),
        }))
        .sort((a, b) => a.name.localeCompare(b.name));
    });
 
    const formatDate = dateString => {
      if (!dateString) return '';
      return new Date(dateString).toLocaleDateString('en-US', {
        month: 'short',
        year: 'numeric',
      });
    };
 
    const formatMatchDate = dateString => {
      if (!dateString) return '';
      return new Date(dateString).toLocaleDateString('en-US', {
        weekday: 'short',
        month: 'short',
        day: 'numeric',
      });
    };
 
    const fetchClub = async () => {
      const clubId = authStore.state.profile?.club_id;
      if (!clubId) return;
 
      try {
        const response = await authStore.apiRequest(
          `${getApiBaseUrl()}/api/clubs/${clubId}`
        );
        if (response) {
          club.value = response;
          // Fetch club teams after getting club
          await fetchClubTeams(clubId);
        }
      } catch (error) {
        console.error('Error fetching club:', error);
      }
    };
 
    const fetchClubTeams = async clubId => {
      try {
        const response = await authStore.apiRequest(
          `${getApiBaseUrl()}/api/clubs/${clubId}/teams`
        );
        if (response) {
          clubTeams.value = response;
        }
      } catch (error) {
        console.error('Error fetching club teams:', error);
      }
    };
 
    const fetchUpcomingMatches = async () => {
      try {
        const response = await fetch(`${getApiBaseUrl()}/api/matches/upcoming`);
        if (response.ok) {
          const matches = await response.json();
          // Filter to club teams if user is a club fan
          if (club.value && clubTeams.value.length > 0) {
            const teamIds = clubTeams.value.map(t => t.id);
            upcomingMatches.value = matches.filter(
              m =>
                teamIds.includes(m.home_team_id) ||
                teamIds.includes(m.away_team_id)
            );
          } else {
            upcomingMatches.value = matches.slice(0, 10);
          }
        }
      } catch (error) {
        console.error('Error fetching upcoming matches:', error);
      }
    };
 
    const initEditForm = () => {
      editForm.display_name = authStore.state.profile?.display_name || '';
      editForm.email = authStore.state.profile?.email || '';
    };
 
    const openEditProfile = () => {
      initEditForm();
      showEditProfile.value = true;
    };
 
    const saveProfile = async () => {
      saving.value = true;
      try {
        const result = await authStore.updateProfile({
          display_name: editForm.display_name,
          email: editForm.email,
        });
        if (result.success) {
          showEditProfile.value = false;
        }
      } catch (error) {
        console.error('Error saving profile:', error);
      } finally {
        saving.value = false;
      }
    };
 
    const goToStandings = () => {
      emit('navigate', 'table');
    };
 
    const goToSchedule = () => {
      emit('navigate', 'scores');
    };
 
    const goToTeams = () => {
      // Teams tab may not exist - navigate to standings as fallback
      emit('navigate', 'table');
    };
 
    const goToTeam = team => {
      // Extract filter IDs from team data
      // The team object from get_club_teams includes:
      // - age_groups: array of {id, name} (processed by backend)
      // - team_mappings: raw data with nested age_groups and divisions
      // - leagues: {id, name} from foreign key
      // - league_id: direct column value
 
      // Get age group ID - try processed array first, then raw team_mappings
      const ageGroupId =
        team.age_groups?.[0]?.id ||
        team.team_mappings?.[0]?.age_groups?.id ||
        null;
 
      // Get league ID - try leagues object first, then direct column
      const leagueId = team.leagues?.id || team.league_id || null;
 
      // Get division ID from team_mappings
      const divisionId = team.team_mappings?.[0]?.divisions?.id || null;
 
      const filters = {
        ageGroupId,
        leagueId,
        divisionId,
      };
 
      console.log('Navigating to table with filters:', filters);
      console.log('Team data:', {
        age_groups: team.age_groups,
        team_mappings: team.team_mappings,
        leagues: team.leagues,
        league_id: team.league_id,
      });
 
      // Navigate to table with filters
      emit('navigate', 'table', filters);
    };
 
    const goToTableWithFilters = (ageGroupId, leagueId, divisionId) => {
      const filters = { ageGroupId, leagueId, divisionId };
      emit('navigate', 'table', filters);
    };
 
    const goToMatchesWithFilters = (ageGroupId, leagueId, divisionId) => {
      const filters = { ageGroupId, leagueId, divisionId };
      emit('navigate', 'scores', filters);
    };
 
    onMounted(async () => {
      await fetchClub();
      await fetchUpcomingMatches();
    });
 
    return {
      authStore,
      club,
      clubTeams,
      groupedTeams,
      upcomingMatches,
      showEditProfile,
      saving,
      editForm,
      displayName,
      followedTeam,
      upcomingMatchCount,
      heroCardStyle,
      clubTeamsStyle,
      leagueHeaderStyle,
      divisionHeaderStyle,
      tableLinkStyle,
      matchesLinkStyle,
      formatDate,
      formatMatchDate,
      openEditProfile,
      saveProfile,
      goToStandings,
      goToSchedule,
      goToTeams,
      goToTeam,
      goToTableWithFilters,
      goToMatchesWithFilters,
    };
  },
};
</script>
 
<style scoped>
.fan-dashboard {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}
 
/* Hero Card */
.hero-card {
  display: flex;
  gap: 30px;
  padding: 30px;
  border-radius: 16px;
  color: white;
  margin-bottom: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}
 
.hero-logo {
  flex-shrink: 0;
}
 
.club-logo-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 12px;
}
 
.club-logo-placeholder,
.league-logo-placeholder {
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
 
.club-logo-placeholder span {
  font-size: 48px;
  font-weight: bold;
  color: white;
}
 
.league-logo-placeholder span {
  font-size: 48px;
}
 
.hero-info {
  flex: 1;
}
 
.club-name-row {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 8px;
}
 
.club-name {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
}
 
.role-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}
 
.location-line {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 10px;
}
 
.fan-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 14px;
  opacity: 0.9;
}
 
.separator {
  opacity: 0.5;
}
 
.hero-stats {
  display: flex;
  gap: 30px;
  margin-bottom: 20px;
}
 
.hero-stat {
  text-align: center;
}
 
.stat-number {
  display: block;
  font-size: 28px;
  font-weight: 700;
}
 
.stat-label {
  display: block;
  font-size: 12px;
  opacity: 0.8;
  text-transform: uppercase;
}
 
.hero-actions {
  display: flex;
  gap: 12px;
}
 
.action-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-size: 14px;
}
 
.action-btn.primary {
  background: white;
  color: #1e3a8a;
}
 
.action-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
 
.action-btn.secondary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
 
.action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.3);
}
 
/* Club Teams Section - Grouped Layout */
.club-teams-section {
  background: white;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
 
.club-teams-section h3 {
  color: #1f2937;
  margin-bottom: 20px;
  font-size: 18px;
}
 
.leagues-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
 
.league-group {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}
 
.league-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  /* Background set via inline style for club theming */
  color: white;
  font-weight: 600;
  font-size: 15px;
}
 
.league-icon {
  font-size: 18px;
}
 
.league-name {
  flex: 1;
}
 
.divisions-container {
  padding: 0;
}
 
.division-group {
  border-bottom: 1px solid #e5e7eb;
}
 
.division-group:last-child {
  border-bottom: none;
}
 
.division-header {
  padding: 10px 16px;
  /* Background and color set via inline style for club theming */
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
 
.age-groups-list {
  padding: 0;
}
 
.age-group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}
 
.age-group-row:last-child {
  border-bottom: none;
}
 
.age-group-row:hover {
  background: #f8fafc;
}
 
.age-group-name {
  font-weight: 500;
  color: #1f2937;
  font-size: 14px;
}
 
.age-group-links {
  display: flex;
  gap: 8px;
}
 
.link-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}
 
.link-btn.table-link {
  /* Background and color set via inline style for club theming */
}
 
.link-btn.table-link:hover {
  filter: brightness(0.9);
}
 
.link-btn.matches-link {
  /* Background and color set via inline style for club theming */
}
 
.link-btn.matches-link:hover {
  filter: brightness(0.9);
}
 
/* Quick Access */
.quick-access-section {
  background: white;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
 
.quick-access-section h3 {
  color: #1f2937;
  margin-bottom: 20px;
  font-size: 18px;
}
 
.quick-cards {
  display: grid;
  gap: 12px;
}
 
.quick-card {
  display: flex;
  align-items: center;
  padding: 18px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #bae6fd;
}
 
.quick-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}
 
.quick-icon {
  font-size: 28px;
  margin-right: 18px;
}
 
.quick-content {
  flex: 1;
}
 
.quick-content h4 {
  margin: 0;
  color: #1e40af;
  font-size: 16px;
}
 
.quick-content p {
  margin: 4px 0 0;
  color: #3b82f6;
  font-size: 13px;
}
 
.quick-arrow {
  color: #3b82f6;
  font-size: 20px;
  font-weight: bold;
}
 
/* Upcoming Matches */
.upcoming-section {
  background: white;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
 
.upcoming-section h3 {
  color: #1f2937;
  margin-bottom: 20px;
  font-size: 18px;
}
 
.matches-list {
  display: grid;
  gap: 10px;
}
 
.match-card {
  display: grid;
  grid-template-columns: 100px 1fr 80px;
  align-items: center;
  padding: 15px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}
 
.match-date {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}
 
.match-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
 
.home-team,
.away-team {
  font-weight: 500;
  color: #1f2937;
}
 
.vs {
  color: #9ca3af;
  font-size: 12px;
}
 
.match-type {
  text-align: right;
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
}
 
/* Features Section */
.features-section {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  border: 1px solid #a7f3d0;
}
 
.features-section h3 {
  color: #047857;
  margin-bottom: 10px;
  font-size: 18px;
}
 
.section-description {
  color: #065f46;
  margin-bottom: 20px;
  font-size: 14px;
}
 
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
}
 
.feature-card {
  background: white;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid #d1fae5;
  transition: all 0.2s;
}
 
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}
 
.feature-icon {
  font-size: 28px;
  margin-bottom: 10px;
}
 
.feature-card h4 {
  margin: 0 0 8px;
  color: #047857;
  font-size: 15px;
}
 
.feature-card p {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
}
 
/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
 
.edit-modal {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
 
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
}
 
.modal-header h3 {
  margin: 0;
  color: #1f2937;
}
 
.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
}
 
.close-btn:hover {
  color: #4b5563;
}
 
.modal-body {
  padding: 20px;
}
 
.form-group {
  margin-bottom: 20px;
}
 
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #374151;
}
 
.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}
 
.form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
 
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px;
  border-top: 1px solid #e5e7eb;
}
 
.cancel-btn {
  padding: 10px 20px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: #4b5563;
  cursor: pointer;
  font-weight: 500;
}
 
.cancel-btn:hover {
  background: #e5e7eb;
}
 
.save-btn {
  padding: 10px 20px;
  background: #3b82f6;
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-weight: 500;
}
 
.save-btn:hover:not(:disabled) {
  background: #2563eb;
}
 
.save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
 
/* Responsive */
@media (max-width: 768px) {
  .hero-card {
    flex-direction: column;
    text-align: center;
    padding: 25px;
  }
 
  .hero-logo {
    margin: 0 auto 20px;
  }
 
  .club-name-row {
    flex-direction: column;
    gap: 10px;
  }
 
  .fan-info {
    flex-direction: column;
    gap: 5px;
  }
 
  .separator {
    display: none;
  }
 
  .hero-stats {
    justify-content: center;
  }
 
  .hero-actions {
    flex-direction: column;
  }
 
  .match-card {
    grid-template-columns: 1fr;
    gap: 8px;
    text-align: center;
  }
 
  .match-type {
    text-align: center;
  }
}
</style>