/* ============================================
   COMPONENTS.CSS - Shared UI Components
   ============================================ */

/* ===== Buttons ===== */
.btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;

    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: #1565C0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: var(--v0-gray-100);
    color: var(--v0-gray-800);
    border: 1px solid var(--v0-gray-200);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--v0-gray-200);
}

.action-btn {
    padding: 0.4rem 0.8rem;
    background: var(--v0-gray-200);
    color: var(--v0-gray-800);
    border: 1px solid var(--v0-gray-300);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.31, 0.1, 0.08, 0.96);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.action-btn:hover {
    background: var(--v0-gray-300);
    border-color: var(--v0-gray-400);
}

.dark .action-btn {
    background: var(--v0-gray-700);
    color: var(--v0-gray-200);
    border-color: var(--v0-gray-600);
}

.dark .action-btn:hover {
    background: var(--v0-gray-600);
}

/* ===== Badges ===== */
.status-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.status-badge.live {
    background: var(--v0-amber-500);
    color: white;
}

.status-badge.completed {
    background: var(--v0-gray-200);
    color: var(--v0-gray-800);
}

.status-badge.active {
    background: #10B981;
    color: white;
}

.status-badge.inactive {
    background: #EF4444;
    color: white;
}

.status-badge.pending {
    background: #F59E0B;
    color: white;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.live {
    background: var(--v0-amber-500);
    color: white;
    border: none;
}

.badge.upcoming {
    background: var(--v0-blue-300);
    color: var(--v0-blue-900);
    border: none;
}

.badge.completed {
    background: var(--v0-gray-200);
    color: var(--v0-gray-800);
    border: none;
}

.badge.division,
.badge.gender {
    background: var(--v0-gray-200);
    color: var(--v0-gray-800);
    border: none;
}

.dark .badge.completed,
.dark .badge.division,
.dark .badge.gender {
    background: var(--v0-gray-700);
    color: var(--v0-gray-200);
}

.user-type-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.user-type-badge.global-admin {
    background: #7C3AED;
    color: white;
}

.user-type-badge.program-admin {
    background: #059669;
    color: white;
}

.user-type-badge.head-referee {
    background: #DC2626;
    color: white;
}

.user-type-badge.referee {
    background: #EA580C;
    color: white;
}

.user-type-badge.fan-view {
    background: #0284C7;
    color: white;
}

.official-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--v0-gray-200);
    color: var(--v0-gray-700);
    border: none;
}

.official-badge.assigned {
    background: var(--v0-blue-300);
    color: var(--v0-blue-900);
}

.dark .official-badge {
    background: var(--v0-gray-700);
    color: var(--v0-gray-300);
}

.dark .official-badge.assigned {
    background: var(--v0-blue-900);
    color: var(--v0-blue-300);
}

/* ===== Cards ===== */
.stat-card {
    background: var(--card);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--v0-gray-200);
    transition: all 0.2s cubic-bezier(0.31, 0.1, 0.08, 0.96);
}

.stat-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    border-color: var(--v0-gray-300);
}

.stat-card.clickable {
    cursor: pointer;
}

.stat-label {
    color: var(--v0-gray-500);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--v0-gray-1000);
}

.stat-icon {
    float: right;
    font-size: 1.5rem;
    color: var(--v0-gray-300);
    opacity: 0.5;
}

.stat-card.alert .stat-value {
    color: #DC2626;
}

.stat-card.alert .stat-icon {
    color: #DC2626;
}

.match-card {
    background: var(--card);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--v0-gray-200);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.31, 0.1, 0.08, 0.96);
    overflow: hidden;
}

.match-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-color: var(--v0-gray-300);
}

.match-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.match-card-header .match-date {
    font-size: 0.8125rem;
    color: var(--v0-gray-500);
}

.match-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.match-badge.live {
    background: var(--v0-amber-500);
    color: white;
}

.match-badge.upcoming {
    background: var(--v0-blue-300);
    color: var(--v0-blue-900);
}

.match-badge.completed {
    background: var(--v0-gray-200);
    color: var(--v0-gray-800);
}

.match-badge.lineup-needed {
    background: #FEE2E2;
    color: #991B1B;
}

.dark .match-badge.completed {
    background: var(--v0-gray-700);
    color: var(--v0-gray-200);
}

.match-teams {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.vs-text {
    font-weight: 600;
    color: var(--v0-gray-500);
}

.match-venue {
    font-size: 0.8125rem;
    color: var(--v0-gray-500);
    margin-bottom: 0.75rem;
}

.match-action-btn {
    flex: 1;
    padding: 0.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.match-action-btn.primary {
    background: var(--primary);
    color: white;
}

.match-action-btn.primary:hover {
    background: #1565C0;
}

.match-action-btn.secondary {
    background: var(--card);
    color: var(--v0-gray-700);
    border: 1px solid var(--v0-gray-200);
}

.match-action-btn.secondary:hover {
    background: var(--v0-gray-100);
}

.match-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.section-card,
.section {
    background: var(--card);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--v0-gray-200);
}

/* ===== Inputs & Forms ===== */
.filter-select,
.filter-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--v0-gray-200);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card);
    color: var(--v0-gray-1000);
    transition: all 0.2s;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
}

.search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border: 1px solid var(--v0-gray-200);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--card);
    color: var(--v0-gray-1000);
    transition: all 0.2s cubic-bezier(0.31, 0.1, 0.08, 0.96);
}

.search-input:focus {
    outline: none;
    border-color: var(--v0-gray-400);
    box-shadow: 0 0 0 3px var(--v0-alpha-400);
}

.search-filter-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--v0-gray-200);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--card);
    color: var(--v0-gray-1000);
    transition: all 0.2s;
    padding-left: 2.5rem;
    width: 100%;
}

.search-filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
}

.search-filter-input::placeholder {
    color: var(--v0-gray-400);
}

.court-select {
    font-size: 0.7rem;
    /* padding: 0.2rem 0.4rem; */
    border-radius: 4px;
    border: 1px solid var(--v0-gray-300);
    background: var(--card);
    color: var(--v0-gray-1000);
    cursor: pointer;
    transition: all 0.2s;
   /* width: 40px;*/
}

.court-select:hover {
    border-color: var(--v0-gray-400);
}

.court-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(30, 136, 229, 0.1);
}

/* ===== Filter Bar ===== */
.filter-bar {
    background: var(--card);
    border-radius: 12px;
    padding: .5rem;
    margin-bottom: .5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--v0-gray-200);
    width: 100%;
    overflow: visible;
    position: relative;
    z-index: 100;
}

.filter-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.filter-bar-header:hover {
    background: var(--v0-gray-100);
    border-radius: 6px;
}

.filter-bar-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--v0-gray-1000);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-bar-toggle-icon {
    transition: transform 0.3s ease;
    transform: rotate(0deg); /* Point down when collapsed */
}

.filter-bar-toggle-icon:not(.collapsed) {
    transform: rotate(180deg); /* Point up when expanded */
}

.filter-bar-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding-top: 1rem;
    overflow: visible;
    position: relative;
}

.filter-bar-content.collapsed {
    display: none;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--v0-gray-700);
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.filter-button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--v0-gray-200);
    background: var(--card);
    color: var(--v0-gray-800);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.31, 0.1, 0.08, 0.96);
    font-family: inherit;
}

.filter-button:hover {
    border-color: var(--v0-gray-300);
    background: var(--v0-gray-100);
}

.filter-button.active {
    background: var(--v0-gray-900);
    color: white;
    border-color: var(--v0-gray-900);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.dark .filter-button.active {
    background: var(--v0-gray-800);
    color: var(--v0-gray-100);
}

.filter-button i {
    margin-right: 0.25rem;
}

/* ===== Autocomplete ===== */
.autocomplete-wrapper {
    position: relative;
    z-index: 100;
}

.autocomplete-wrapper .filter-input {
    width: 100%;
    padding-right: 2rem;
    font-size: 0.8125rem;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card);
    border: 1px solid var(--v0-gray-200);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    max-height: 220px;
    overflow-y: auto;
    z-index: 99999;
    display: none;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-bottom: 1px solid var(--v0-gray-100);
    transition: background 0.15s;
    font-size: 0.75rem;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background: var(--v0-gray-100);
}

.autocomplete-item-name {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--v0-gray-900);
}

.autocomplete-item-meta {
    font-size: 0.6875rem;
    color: var(--v0-gray-500);
}

.autocomplete-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--v0-gray-400);
    cursor: pointer;
    padding: 0.25rem;
}

.autocomplete-clear:hover {
    color: var(--v0-gray-600);
}

.autocomplete-loading,
.autocomplete-no-results {
    padding: 0.5rem;
    text-align: center;
    color: var(--v0-gray-500);
    font-size: 0.75rem;
}

.autocomplete-loading i {
    margin-right: 0.375rem;
}

/* ===== Tables ===== */
.users-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.users-table thead {
    background: var(--v0-gray-100);
}

.users-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--v0-gray-700);
    border-bottom: 2px solid var(--v0-gray-200);
}

.users-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--v0-gray-800);
    border-bottom: 1px solid var(--v0-gray-200);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.users-table tbody tr {
    cursor: pointer;
    transition: all 0.2s;
}

.users-table tbody tr:hover {
    background: var(--v0-gray-100);
}

/* ===== Search ===== */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: #7f8c8d;
}

.search-filter-wrapper {
    position: relative;
    flex: 1;
}

.search-filter-wrapper .search-filter-input {
    padding-left: 2.5rem;
}

.search-filter-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--v0-gray-400);
    pointer-events: none;
}

.search-filter {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* ===== Tabs ===== */
.tabs-container {
    background: var(--card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--v0-gray-200);
    margin-bottom: 1.5rem;
}

.tabs-header {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--v0-gray-200);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--v0-gray-600);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-button:hover {
    color: var(--primary);
    background: var(--v0-gray-100);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    min-height: 400px;
}

.tab-content.active {
    display: block;
}

.tab-content-wrapper {
    width: 100%;
}

/* Mobile responsive tabs */
@media (max-width: 768px) {
    .tabs-container {
        padding: 0.5rem;
        border-radius: 10px;
        margin-bottom: 0.75rem;
    }
    
    .tabs-header {
        margin-bottom: 0.75rem;
        gap: 0.25rem;
        padding-bottom: 0;
    }
    
    .tab-button {
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
        gap: 0.375rem;
    }
    
    .tab-button i {
        font-size: 0.875rem;
    }
    
    .tab-content {
        min-height: auto;
    }
    
    /* Reduce padding on tab content panels */
    #eventsTab,
    #programsTab,
    #usersTab {
        padding: 0;
    }
    
    .tab-content-wrapper {
        padding: 0;
    }
}

/* ===== Match Actions Container ===== */
.match-actions-container {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* ===== Empty States ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--v0-gray-500);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
}

/* ===== Pulse Dot ===== */
.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--v0-amber-500);
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.25rem;
    animation: pulse 2s infinite;
}

.match-header .pulse-dot {
    background: var(--v0-amber-500);
}

/* ===== Team Logo with Initials Fallback ===== */
.team-logo-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.team-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    background: white;
}

.team-logo-img.hidden {
    display: none;
}

.team-logo-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 700;
    text-transform: uppercase;
    color: white;
    background: linear-gradient(135deg, #1E88E5, #1565C0);
    user-select: none;
}

.team-logo-fallback.visible {
    display: flex;
}

/* Logo size variants */
.team-logo-xs {
    width: 24px;
    height: 24px;
    font-size: 0.625rem;
}

.team-logo-sm {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.team-logo-md {
    width: 48px;
    height: 48px;
    font-size: 1rem;
}

.team-logo-lg {
    width: 64px;
    height: 64px;
    font-size: 1.25rem;
}

.team-logo-xl {
    width: 80px;
    height: 80px;
    font-size: 1.5rem;
}

/* Fallback color variations based on team name hash */
.team-logo-fallback.color-1 { background: linear-gradient(135deg, #E53935, #C62828); }
.team-logo-fallback.color-2 { background: linear-gradient(135deg, #8E24AA, #6A1B9A); }
.team-logo-fallback.color-3 { background: linear-gradient(135deg, #3949AB, #283593); }
.team-logo-fallback.color-4 { background: linear-gradient(135deg, #1E88E5, #1565C0); }
.team-logo-fallback.color-5 { background: linear-gradient(135deg, #00ACC1, #00838F); }
.team-logo-fallback.color-6 { background: linear-gradient(135deg, #43A047, #2E7D32); }
.team-logo-fallback.color-7 { background: linear-gradient(135deg, #FB8C00, #EF6C00); }
.team-logo-fallback.color-8 { background: linear-gradient(135deg, #6D4C41, #4E342E); }

