/* --- General Tab Styles --- */
.charity-data-tabs .tab-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0px;
}

.charity-data-tabs .tab-button {
    display: flex;
    width: 50%;
    height: 60px;
    min-width: 150px;
    padding: 12px 20px;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    border-radius: 10px 10px 0px 0px;
    border-top: 2px solid var(--wp--preset--color--contrast);
    border-right: 2px solid var(--wp--preset--color--contrast);
    border-left: 2px solid var(--wp--preset--color--contrast);
    border-bottom: 2px solid var(--wp--preset--color--accent-1);
    background: var(--wp--preset--color--contrast);
    color: var(--wp--preset--color--base);
    font-style: normal;
    font-weight: 800;
    font-size: var(--wp--preset--font-size--medium);
    cursor: pointer;
    text-transform: uppercase;
    
}

.charity-data-tabs .tab-button.active {
    background-color: var(--wp--preset--color--base);
    color: var(--wp--preset--color--accent-1);
    border-radius: 10px 10px 0px 0px;
    border-top: 2px solid var(--wp--preset--color--accent-1);
    border-right: 2px solid var(--wp--preset--color--accent-1);
    border-left: 2px solid var(--wp--preset--color--accent-1);
    border-bottom: none;
}

.charity-data-tabs .tab-button.active:focus{
        outline-width: 0px;
        outline-style: none;
}

.charity-data-tabs .tab-content {
    border-radius: 0px 0px 10px 10px;
    border-right: 2px solid var(--wp--preset--color--accent-1);
    border-bottom: 2px solid var(--wp--preset--color--accent-1);
    border-left: 2px solid var(--wp--preset--color--accent-1);
    background: var(--wp--preset--color--base);
    padding: 40px;
}

.charity-data-tabs .tab-panel {
    display: none;
}

.charity-data-tabs .tab-panel.active {
    display: block;
}

.charity-ais-data .data-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}
.charity-ais-data .label {
    font-weight: bold;
}

/* --- charity-description.php ----- */
.charity-excerpt-indicators .charity-indicators {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.charity-excerpt-indicators .charity-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: #f0f0f0;
    padding: 5px 10px;
    border-radius: 5px;
}

.charity-excerpt-indicators .charity-indicator img {
    height:20px;
    width:20px;
}

/* --- Other Organisation Names (in description) --- */
.other-organisation-names {
    margin-bottom: 20px;
    padding: 15px 20px;
    background-color: #f0f4f8; /* A light blue-grey background */
    border: 1px solid #d6e0ea;
    border-radius: 5px;
}

.other-organisation-names h4 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1em;
    font-weight: bold;
}

.other-organisation-names p {
    margin: 0;
    font-style: italic;
}
/* --- Rank Math Breadcrumbs ----- */

.charity-template-default .rank-math-breadcrumb {
    font-size: var(--wp--preset--font-size--small);
}

/* --- charity-meta.php styles --- */
.charity-meta-rows .meta-row {
    display: flex;
    align-items: center; /* Vertically align items */
    margin-bottom: 8px; /* Add some space between rows */
}

.charity-meta-rows .meta-label {
    font-weight: bold;
    min-width: 170px; /* Adjust as needed */
    margin-right: 10px;
    flex-shrink: 0; /* Prevent label from shrinking */
}

.charity-meta-rows .meta-value {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 8px; /* Vertical and horizontal gap for wrapped items */
}

.charity-meta-rows .meta-value a {
    text-decoration: underline;
}

.social-links a {
    text-decoration: none;
    margin-right: 10px;
}

/* --- Data Table/Grid Layouts (Team & Financials) --- */

/* Financial Summary Rows */
.financial-summary-rows {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-bottom: 10px;
    overflow: visible; /* Ensure tooltips are not clipped */
    position: relative; /* Stacking context for tooltips */
    z-index: 1;
}

/* Team Data Section */
.team-data-container {
    margin-top: 15px;
}

.team-data-rows {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.team-data-row:not(:last-child) {
    border-bottom: 1px solid #e0e0e0;
}

.summary-row {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #f8f9fa; /* Same as accordion header */
}

.summary-row:first-child {
    border-bottom: 1px solid #e0e0e0;
}

/* Shared Row Styles */
.team-data-row,
.summary-row,
.category-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #f8f9fa;
}

.team-data-row .label,
.summary-row-title,
.category-header .category-title {
    flex: 3;
    font-weight: bold;
    color: #333;
}

.team-data-row .value,
.team-data-row .average,
.summary-row-value,
.summary-row-average,
.category-header .category-value,
.category-header .category-average {
    flex: 2;
    text-align: right;
    font-weight: bold;
}

/* Shared Header Styles */
.team-data-header,
.financial-main-header {
    display: flex;
    padding: 10px 15px;
    font-weight: bold;
    color: #555;
    border-bottom: 1px solid #e0e0e0;
}

.label-header,
.category-title-header {
    flex: 3;
}

.value-header,
.average-header,
.category-value-header,
.category-average-header {
    flex: 2;
    text-align: right;
}

/* --- Financial Accordion Specifics --- */
.financial-category {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-bottom: 10px;
    overflow: visible; /* Ensure tooltips are not clipped */
    position: relative; /* Stacking context for tooltips */
    z-index: 1;
}

.category-header {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.category-header:hover { background-color: #e9ecef; }
.category-header .category-toggle-icon { margin-left: auto; transition: transform 0.3s ease; }
.category-header.expanded .category-toggle-icon { transform: rotate(180deg); }

.category-details {
    display: none;
    padding: 0;
    background-color: #fff;
}

.category-details table { width: 100%; border-collapse: collapse; }
.category-details tr { border-top: 1px solid #e0e0e0; }
.category-details td { padding: 12px 15px; }
.category-details td:nth-child(1) { width: 50%; }
.category-details td:nth-child(2), .category-details td:nth-child(3) { width: 25%; text-align: right; }

/* Placeholder for toggle icon to maintain alignment */
.category-toggle-icon-placeholder {
    display: inline-block;
    width: 20px; /* Match dashicon width */
    height: 20px; /* Match dashicon height */
    margin-left: auto;
    flex-shrink: 0; /* Prevent it from shrinking */
}

/* Styles for non-expandable headers */
.category-header.non-expandable {
    cursor: default;
}

.category-header.non-expandable:hover {
    background-color: #f8f9fa; /* Revert hover effect */
}

/* --- Tooltip Styles --- */
.tooltip-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    cursor: help;
    vertical-align: middle; /* Helps align the icon with text */
}

.tooltip-icon-wrapper .dashicons {
    font-size: 18px;
    color: #888;
    transition: color 0.2s ease;
}

.tooltip-icon-wrapper:hover .dashicons {
    color: #333;
}

/* Tooltip z-index fix to prevent clipping */
.financial-summary-rows:has(.tooltip-icon-wrapper:hover),
.financial-summary-rows:has(.tooltip-icon-wrapper:focus-within),
.financial-category:has(.tooltip-icon-wrapper:hover),
.financial-category:has(.tooltip-icon-wrapper:focus-within) {
    z-index: 10;
}

/* Reporting Requirements Section */
.reporting-requirements {
    background-color: #f0f4f8; /* A light blue-grey background */
    border: 1px solid #d6e0ea;
    border-radius: 5px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.reporting-requirements h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--wp--preset--color--contrast); /* Use theme color */
}

.reporting-requirements p {
    margin-bottom: 0;
    font-size: 0.95em;
    line-height: 1.5;
}

/* --- Mobile Responsive Styles --- */
@media (max-width: 768px) {
    .charity-data-tabs .tab-content {
        padding: 20px 15px;
    }

    /* Hide the main header and rely on per-item labels */
    .financial-main-header {
        display: none;
    }

    /* Restyle summary rows to stack content */
    .team-data-row,
    .summary-row,
    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        position: relative;
    }

    .team-data-row .label,
    .summary-row-title,
    .category-header .category-title {
        flex: 1 1 100%;
        margin-bottom: 5px;
    }

    .team-data-row .value,
    .team-data-row .average,
    .summary-row-value,
    .summary-row-average,
    .category-header .category-value,
    .category-header .category-average {
        flex: 1 1 100%;
        text-align: right;
        width: 100%;
        padding-left: 140px; /* Make space for the label */
        box-sizing: border-box;
        position: relative;
    }

    /* Add labels using ::before pseudo-elements */
    .team-data-row .value::before,
    .summary-row-value::before,
    .category-header .category-value::before {
        content: 'Charity Value:';
        position: absolute;
        left: 0;
        font-weight: normal;
        color: #555;
        text-align: left;
    }

    .team-data-row .average::before,
    .summary-row-average::before,
    .category-header .category-average::before {
        content: 'Australian Average:';
        position: absolute;
        left: 0;
        font-weight: normal;
        color: #555;
        text-align: left;
    }

    /* Reposition accordion toggle icon */
    .category-header .category-toggle-icon,
    .category-header .category-toggle-icon-placeholder {
        position: absolute;
        top: 15px;
        right: 15px;
        margin-left: 0;
    }

    /* Transform details table into a list-like view */
    .category-details table, .category-details tbody, .category-details tr, .category-details td {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
    }
    .category-details tr { padding: 10px 0; }
    .category-details td { text-align: right; padding-left: 50%; position: relative; }
    .category-details td:nth-child(1) { padding-left: 0; text-align: left; font-weight: bold; margin-bottom: 8px; }
    .category-details td:nth-child(2)::before { content: 'Charity Value:'; position: absolute; left: 0; font-weight: normal; color: #555; }
    .category-details td:nth-child(3)::before { content: 'Average:'; position: absolute; left: 0; font-weight: normal; color: #555; }
}
