/* Coach Directory Public Styles */
.coachdb-directory-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1e293b;
    max-width: 1200px;
    margin: 2rem auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* Filters Section */
.coachdb-filters-section {
    padding: 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.coachdb-search-bar-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.coachdb-search-bar-row .coachdb-search-box {
    flex: 1 1 320px;
}

.coachdb-search-box input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.coachdb-search-box input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.coachdb-filters-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.15rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    height: 45px;
    box-sizing: border-box;
    margin-bottom: 2px;
}

.coachdb-filters-toggle:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.coachdb-filters-toggle:focus-visible {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.coachdb-filters-toggle.coachdb-filters-open {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.coachdb-toggle-arrow {
    display: inline-block;
    font-size: 0.65rem;
    transition: transform 0.25s ease;
}

.coachdb-filters-toggle.coachdb-filters-open .coachdb-toggle-arrow {
    transform: rotate(180deg);
}

.coachdb-filter-count-badge {
    background: #2563eb;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
}

.coachdb-filters-toggle.coachdb-filters-open .coachdb-filter-count-badge {
    background: #1d4ed8;
}

.coachdb-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #64748b;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.coachdb-clear-filters:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.coachdb-filter-group-label {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    color: #475569;
    display: block;
}

.coachdb-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
}

.coachdb-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.coachdb-checkbox-item input {
    cursor: pointer;
}

/* Table Section */
.coachdb-table-wrapper {
    overflow-x: auto;
}

.coachdb-directory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.coachdb-directory-table th {
    background: #fff;
    text-align: left;
    padding: 1rem;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid #f1f5f9;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.coachdb-sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.coachdb-sortable:hover {
    background: #f8fafc;
    color: #1e293b;
}

.coachdb-sortable .coachdb-sort-icon {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 0.4rem;
    vertical-align: middle;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
    opacity: 0.3;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}

.coachdb-sortable:not(.coachdb-sort-active) .coachdb-sort-icon {
    border-bottom: 4px solid #64748b;
}

.coachdb-sortable.coachdb-sort-active.coachdb-sort-asc {
    color: #1e293b;
}

.coachdb-sortable.coachdb-sort-active.coachdb-sort-asc .coachdb-sort-icon {
    border-bottom: 5px solid #2563eb;
    border-top: 0;
    opacity: 1;
}

.coachdb-sortable.coachdb-sort-active.coachdb-sort-desc {
    color: #1e293b;
}

.coachdb-sortable.coachdb-sort-active.coachdb-sort-desc .coachdb-sort-icon {
    border-top: 5px solid #2563eb;
    border-bottom: 0;
    opacity: 1;
}

.coachdb-directory-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.coachdb-row-main {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.coachdb-row-main:hover {
    background-color: #f1f5f9;
}

.coachdb-row-main.coachdb-row-expanded {
    background-color: #f1f5f9;
}

.coachdb-row-main:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

.coachdb-roles-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.coachdb-role-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
}

.coachdb-role-default {
    background: #f1f5f9;
    color: #475569;
}

.coachdb-role-green {
    background: #dcfce7;
    color: #166534;
}

.coachdb-role-orange {
    background: #ffedd5;
    color: #9a3412;
}

.coachdb-role-red {
    background: #fee2e2;
    color: #991b1b;
}

.coachdb-toggle-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    margin-right: 0.5rem;
}

.coachdb-toggle-link:hover {
    text-decoration: underline;
    color: #1d4ed8;
}

.coachdb-branch-link {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.15s ease-in-out;
}

.coachdb-branch-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Expanded Row */
.coachdb-row-details {
    background: #f1f5f9;
    display: none;
}

.coachdb-details-content {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .coachdb-details-content {
        grid-template-columns: 1fr 1fr;
    }
}

.coachdb-details-column h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #334155;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 0.5rem;
}

.coachdb-detail-item {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.coachdb-detail-label {
    font-weight: 600;
    color: #64748b;
    width: 140px;
    display: inline-block;
}

.coachdb-detail-value {
    color: #1e293b;
}

.coachdb-expiry-valid {
    color: #166534;
    font-weight: 500;
}

.coachdb-expiry-expired {
    color: #dc2626;
    font-weight: 500;
}

/* Pagination */
.coachdb-pagination {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border-top: 1px solid #e2e8f0;
}

.coachdb-pagination-info {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.coachdb-pagination-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.coachdb-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
    user-select: none;
}

.coachdb-page-link:hover:not(.active):not(.coachdb-page-disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
}

.coachdb-page-link.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
    cursor: default;
}

.coachdb-page-link.coachdb-page-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #94a3b8;
}

.coachdb-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 2.25rem;
    color: #94a3b8;
    font-size: 0.875rem;
    user-select: none;
}

/* Loading State */
.coachdb-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Hide empty paragraphs injected by WordPress wpautop */
.coachdb-directory-container p:empty,
.coachdb-directory-container p:blank {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}