body { font-family: 'Inter', sans-serif; background-color: #f0f4f8; }
.modal { display: none; position: fixed; z-index: 100; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); align-items: center; justify-content: center; }
.modal-content { background-color: #ffffff; padding: 24px; border-radius: 8px; width: 90%; max-width: 600px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); max-height: 90vh; overflow-y: auto; }
.manager-only, .admin-tab-content { display: none; }
.table-header { background-color: #e2e8f0; }
.btn { padding: 8px 16px; border-radius: 6px; font-weight: 500; transition: all 0.2s; cursor: pointer; border: none; display: inline-flex; align-items: center; justify-content: center; }
.btn i { margin-right: 6px; }
.btn-primary { background-color: #3b82f6; color: white; } .btn-primary:hover { background-color: #2563eb; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn-secondary { background-color: #6b7280; color: white; } .btn-secondary:hover { background-color: #4b5563; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn-danger { background-color: #ef4444; color: white; } .btn-danger:hover { background-color: #dc2626; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn-success { background-color: #22c55e; color: white; } .btn-success:hover { background-color: #16a34a; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #888; border-radius: 10px; } ::-webkit-scrollbar-thumb:hover { background: #555; }
select { -webkit-appearance: menulist-button; -moz-appearance: menulist-button; appearance: menulist-button; background-color: white; border: 1px solid #ccc; padding: 0.5rem; border-radius: 0.375rem; }
.tab-button { padding: 0.5rem 1rem; margin-right: 0.5rem; border-radius: 0.375rem 0.375rem 0 0; background-color: #e2e8f0; border: 1px solid #cbd5e1; border-bottom: none; cursor: pointer; display: inline-flex; align-items: center; }
.tab-button i { margin-right: 6px; }
.tab-button.active { background-color: #3b82f6; color: white; border-color: #3b82f6; }
.tab-content { display: none; padding: 1.5rem; background-color: white; border-radius: 0 0.375rem 0.375rem 0.375rem; border: 1px solid #cbd5e1; box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); }
.tab-content.active { display: block; }
.greyed-out-option { color: #9ca3af; background-color: #f3f4f6; }

/* Bar chart styles */
.bar-chart-container { padding: 0.5rem; }
.bar-chart-row { display: flex; align-items: center; margin-bottom: 8px; }
.bar-chart-label { width: 30%; min-width: 100px; font-size: 0.9rem; }
.bar-chart-bar-container { flex-grow: 1; background-color: #f1f5f9; border-radius: 4px; margin: 0 8px; overflow: hidden; }
.bar-chart-bar { height: 24px; background-color: #3b82f6; border-radius: 4px 0 0 4px; transition: width 0.5s ease; }
.bar-chart-value { width: 40px; text-align: right; font-size: 0.9rem; font-weight: 600; }

/* Status indicator */
.status-indicator { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 16px; font-size: 0.825rem; background-color: #f0f4f8; }
.status-indicator i { margin-right: 4px; font-size: 0.75rem; }
.status-indicator.synced { background-color: #dcfce7; color: #166534; }
.status-indicator.error { background-color: #fee2e2; color: #b91c1c; }
.status-indicator.loading { background-color: #e0f2fe; color: #0369a1; }

/* Header improvements */
.app-header { 
    background-color: white; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-radius: 8px;
    padding: 18px 24px;
    margin-bottom: 24px;
}

/* Card styles */
.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 16px;
    margin-bottom: 16px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f4f8;
}

/* Table improvements */
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}
tr:hover td {
    background-color: #f9fafb;
}

/* No Game styling */
.no-game-badge {
    display: inline-block;
    padding: 2px 8px;
    background-color: #f3f4f6;
    color: #6b7280;
    border-radius: 4px;
    font-size: 0.825rem;
    font-style: italic;
}

.btn-sm { padding: 4px 8px; font-size: 0.75rem; }

/* Styles for new header manager actions */
#managerLoginSection {
    display: none !important; /* Hide the old card */
}

.header-manager-actions {
    display: flex;
    align-items: center;
    gap: 6px; /* Smaller gap for compact buttons */
}

/* Refine .btn-sm for header controls if needed, or ensure it works well */
.header-manager-actions .btn-sm {
    padding: 5px 10px; /* Slightly adjusted padding */
    font-size: 0.8rem; 
    line-height: 1.2; /* Ensure text is vertically centered */
}

.header-manager-actions .btn-icon {
    padding: 5px 8px;
    font-size: 0.9rem;
}

/* Outline button styles */
.btn-outline-primary {
    background-color: transparent;
    border: 1px solid #3b82f6; /* blue-500 */
    color: #3b82f6;
}
.btn-outline-primary:hover {
    background-color: #3b82f6;
    color: white;
}

.btn-outline-secondary {
    background-color: transparent;
    border: 1px solid #6b7280; /* gray-500 */
    color: #6b7280;
}
.btn-outline-secondary:hover {
    background-color: #6b7280;
    color: white;
}

/* --- Compact Manager Access Card Styles --- */
.manager-access-compact {
    padding: 8px 12px !important; /* Override .card padding */
    margin-bottom: 12px !important; /* Override .card margin */
    max-width: 380px; /* Make it narrower */
    margin-left: auto;  /* Align to the right */
    margin-right: 0; /* Ensure it aligns to the very right if container has padding */
    background-color: #f9fafb; /* Slightly different background if needed, or keep white */
}
.manager-access-compact .card-header {
    padding-bottom: 6px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e5e7eb; /* Lighter border or remove */
}
.manager-access-compact h2 {
    font-size: 0.9rem !important; /* Smaller heading text */
    font-weight: 600; /* Adjust weight if needed */
}
.manager-access-compact .btn {
    padding: 4px 10px !important; /* Smaller button padding */
    font-size: 0.8rem !important; /* Smaller button text */
}
.manager-access-compact .btn i {
    margin-right: 4px; /* Adjust icon margin if needed */
}
/* --- End Compact Manager Access Card Styles --- */

/* --- Desktop Styles for Availability Table (outside media query) --- */
#availabilityTable td.game-date-header-mobile {
    /* Standard table cell for desktop */
    cursor: default; /* Remove pointer cursor */
    background-color: transparent; /* Ensure no mobile-specific background */
    font-weight: normal; /* Reset font weight if mobile changed it */
    /* Retain padding and borders as per default table cell styling */
    padding: 0.75rem; /* Example, adjust to match other cells */
    border-bottom: 1px solid #e2e8f0;
}

#availabilityTable td.game-date-header-mobile .toggle-icon {
    display: none; /* Hide mobile toggle icon on desktop */
}

#availabilityTable td.availability-details-cell-mobile {
    display: contents; /* Key change: This TD's children treated as TR's children */
    padding: 0; /* Reset padding, as it's now a container */
    border: none; /* Reset border */
}

/* This is the DIV inside availability-details-cell-mobile */
/* It contains the individual family+checkbox DIVs */
.availability-details-mobile {
    display: contents; /* Key change: Its children (family divs) flow as table cells */
    /* This div itself is not styled as a visible block on desktop */
}

/* This is the div for each family (name + checkbox), becomes a table cell on desktop */
/* This rule targets the class "mobile-pseudo-cell" which is applied in the JS to these divs */
#availabilityTable .mobile-pseudo-cell { 
    display: table-cell !important; /* Override mobile's display:flex if it's too specific */
    padding: 0.75rem; /* Standard cell padding */
    text-align: center; 
    border-bottom: 1px solid #e2e8f0; /* Standard cell border */
    vertical-align: middle;
    background-color: transparent; /* Ensure no mobile specific background */
}

#availabilityTable .mobile-pseudo-cell::before {
    content: none !important; /* Hide data-label (family name) on desktop */
    display: none !important;
}

/* Ensure checkboxes are visible and centered */
#availabilityTable .mobile-pseudo-cell input[type="checkbox"] {
    display: inline-block; /* Or block with margin auto for centering */
    margin: 0 auto;
}
/* --- End Desktop Styles for Availability Table --- */

/* --- Field Map Highlight Styles --- */
#fieldMapContainer {
    position: relative; /* Establishes a positioning context for absolute children */
    display: inline-block; /* Or block, depending on layout needs */
}

.field-highlight {
    position: absolute;
    background-color: rgba(255, 255, 0, 0.4); /* Semi-transparent yellow, adjust as needed */
    border: 2px solid yellow; /* Adjust color and thickness */
    border-radius: 4px; /* Optional: rounded corners */
    display: none; /* Hidden by default */
    pointer-events: none; /* Allows clicks to pass through to the map if needed */
}

/* Individual field positions - these are % based on the map image itself */
/* These will likely need adjustment based on the actual image dimensions and content */
#highlight-belnorth-b {
    top: 86%; left: 54%; width: 12%; height: 13%; transform: rotate(-12deg);
}
#highlight-6a {
    top: 16%; left: 22%; width: 11%; height: 11.3%; transform: rotate(-18deg);
}
/* --- End Field Map Highlight Styles --- */

/* --- Custom Checkbox Styles --- */
.custom-checkbox-label {
    display: inline-flex; /* Aligns the hidden input and custom UI if they were side-by-side */
    align-items: center;
    position: relative; /* For positioning the hidden input if needed */
    cursor: pointer;
    /* Ensure the label takes up appropriate space in flex layouts */
}

/* Hide the actual checkbox input but keep it functional and accessible */
.custom-checkbox-label input[type="checkbox"].sr-only {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkbox-ui {
    display: inline-block;
    width: 22px;  /* Slightly larger for better touch target & visual */
    height: 22px;
    border-radius: 4px;
    position: relative;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    font-family: "Font Awesome 6 Free"; /* Ensure FontAwesome is used */
    font-weight: 900; /* For solid icons */
    font-size: 12px; /* Adjust icon size */
    line-height: 22px; /* Vertically center icon */
    text-align: center;
    color: white; /* Icon color */
}

/* Style for UNCHECKED (Unavailable) state */
.custom-checkbox-label input[type="checkbox"].sr-only + .custom-checkbox-ui {
    background-color: #9ca3af; /* Tailwind gray-400 */
    border: 1px solid #6b7280; /* Tailwind gray-500 for border */
}
.custom-checkbox-label input[type="checkbox"].sr-only + .custom-checkbox-ui::before {
    content: "\f00d"; /* FontAwesome times (X) icon */
}

/* Style for CHECKED (Available) state */
.custom-checkbox-label input[type="checkbox"].sr-only:checked + .custom-checkbox-ui {
    background-color: #22c55e; /* Tailwind green-500 */
    border-color: #16a34a; /* Tailwind green-600 for border */
}
.custom-checkbox-label input[type="checkbox"].sr-only:checked + .custom-checkbox-ui::before {
    content: "\f00c"; /* FontAwesome check icon */
}

/* Focus style for accessibility - apply to the custom UI when the hidden input is focused */
.custom-checkbox-label input[type="checkbox"].sr-only:focus + .custom-checkbox-ui {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5); /* Example focus ring, blue-500 */
}
/* --- End Custom Checkbox Styles --- */

/* --- Mobile Availability Summary Styles --- */
.availability-summary-mobile {
    font-size: 0.8em; /* Slightly smaller than the date text */
    /* color: #4b5563; */ /* Base color removed, individual spans will have color */
    margin-left: 6px; /* Space between date and summary */
    display: inline; /* Changed from none to inline: Show by default on all views */
}
.summary-count-available {
    color: #16a34a; /* Tailwind green-600 (a bit darker green for text) */
    font-weight: 600; /* Increased font-weight for better prominence */
}
.summary-count-unavailable {
    color: #6b7280; /* Changed from red to Tailwind gray-500 */
    font-weight: 600; /* Increased font-weight for better prominence */
}
.availability-summary-mobile i {
    margin-right: 3px; /* Small space between icon and text */
}
/* --- End Mobile Availability Summary Styles --- */

@media screen and (max-width: 768px) {
    /* Responsive Table for Availability - Collapsible Mobile View */
    #availabilityTable thead {
        display: none; /* Hide table headers on mobile */
    }
    #availabilityTable,
    #availabilityTable tbody,
    #availabilityTable tr { /* TDs are handled specifically below */
        display: block;
        width: 100%;
    }
    #availabilityTable tr {
        margin-bottom: 1rem; /* Space between game blocks */
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        overflow: hidden; /* Ensures children (like cells) respect border radius */
    }

    /* Common style for all TDs in availabilityTable for mobile to reset */
    #availabilityTable td {
        display: block; /* Override browser default */
        width: 100%;
        border-bottom: none; /* Reset, specific cells will add if needed */
        padding: 0; /* Reset, specific cells will add if needed */
    }
    #availabilityTable td::before { /* Reset generic data-label for TDs */
        content: none;
    }

    /* Style for the game date header cell in mobile */
    #availabilityTable td.game-date-header-mobile {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem; /* Adjusted padding */
        font-weight: bold;
        cursor: pointer;
        background-color: #f9fafb; /* Light background for the header */
        border-bottom: 1px solid #e2e8f0; /* Line below header */
    }
    /* Ensure toggle icon is visible on mobile, overriding desktop's display:none */
    #availabilityTable td.game-date-header-mobile .toggle-icon {
        display: inline-block !important; /* Make sure it's visible */
        margin-left: 8px;
        font-size: 0.9em; 
        transition: transform 0.2s ease-in-out;
    }
    /* Ensure summary span is always visible on mobile */
    #availabilityTable td.game-date-header-mobile .availability-summary-mobile {
            display: inline !important; /* Ensure it remains inline on mobile */
    }
    
    /* Style for the cell containing the availability details (the one with colSpan) */
    /* On mobile, this cell also becomes a block */
    #availabilityTable td.availability-details-cell-mobile {
        display: block !important; /* Override display:contents from desktop */
        width: 100%;
        padding: 0;
        border-bottom: none; /* Managed by TR border */
    }

    /* The container for family checkboxes, hidden/shown on mobile */
    .availability-details-mobile {
        display: none !important; /* Collapsed by default, override display:contents */
        padding: 0.5rem 1rem 0.25rem 1rem; 
        background-color: #fff; 
    }

    .availability-details-mobile.expanded {
        display: block !important; /* Show when expanded */
    }

    /* Styling for each family row (div) within the details container (mobile-pseudo-cell) */
    /* This must override the desktop table-cell behavior */
    #availabilityTable .mobile-pseudo-cell {
        display: flex !important; /* Override table-cell for mobile */
        justify-content: space-between;
        align-items: center;
        padding: 0.6rem 0 !important; 
        border-bottom: 1px solid #f3f4f6 !important; 
        text-align: left !important; /* Reset text-align from desktop */
    }

    #availabilityTable .mobile-pseudo-cell:last-child {
        border-bottom: none !important;
    }

    /* Apply data-label for family names using ::before on the div for mobile */
    /* This must override the desktop's content:none */
    #availabilityTable .mobile-pseudo-cell::before {
        display: inline-block !important; /* Ensure it's visible */
        content: attr(data-label) !important;
        font-weight: 500; 
        margin-right: 0.5rem;
        flex-shrink: 0; 
    }

    #availabilityTable .mobile-pseudo-cell input[type="checkbox"] {
        /* The input is now hidden. The label (.custom-checkbox-label) is the flex item. */
    }

    /* Ensure the label (which now contains the custom checkbox) is pushed to the right */
    #availabilityTable .mobile-pseudo-cell .custom-checkbox-label {
        margin-left: auto !important; 
        flex-shrink: 0;
    }

    /* Mobile styles for Tab Navigation */
    /* Re-enable wrapping for tabs if it was disabled by previous attempts */
    #tabsNav {
        flex-wrap: wrap !important; /* Ensure tabs wrap */
        gap: 0.5rem; /* Add gap for consistent spacing horizontally and vertically */
    }

    #tabsNav .tab-button {
        width: calc(50% - 0.25rem); /* Aim for two tabs per row, accounting for a 0.5rem gap */
        margin-right: 0; /* Remove specific right margin, use gap or general margin */
        margin-bottom: 0; /* Vertical spacing now handled by 'gap' on parent */
        justify-content: center; /* Center icon and text within the tab */
    }

    /* Optional: if there's an odd number of tabs, make the last one full width */
    /* #tabsNav .tab-button:last-child:nth-child(odd) {
        width: 100%;
    } */
}

#tabsNav {
    /* Existing: mb-0 flex flex-wrap */
    /* On desktop, flex-wrap: wrap is fine */
}

.app-header > div {
    /* Direct child of app-header, the one with md:flex-row */
    /* On mobile (default), ensure it handles its children correctly */
}

.app-header > div > .flex.items-center.gap-x-4 {
        /* This is the container for dataStatus and headerManagerActions */
    width: 100%; /* Make it take full width on mobile */
    justify-content: space-between; /* Space out status and actions */
    margin-top: 8px; /* Add some top margin on mobile if stacked */
}

@media screen and (min-width: 769px) { /* md breakpoint and up */
    .app-header > div > .flex.items-center.gap-x-4 {
        width: auto; /* Revert to auto width on desktop */
        justify-content: flex-end; /* Align to end on desktop */
        margin-top: 0; /* Remove top margin on desktop */
    }
} 