@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap');

/* =========================================================
   BPDA Leader Hub — Styles v10
   ========================================================= */

/* ---------------------------------------------------------
   Tab bar
   --------------------------------------------------------- */

.bpda-tab-bar {
    position: sticky;
    top: 0; /* overridden by JS to sit below the fixed site header */
    z-index: 999;
    display: flex;
    align-items: flex-end;
    padding: 0.5rem 0 0;
    background: #F3EFEC;
    border-bottom: 4px solid #1F2B8E;
}

.bpda-tab-buttons {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    flex: 1;
}

.bpda-tab-btn {
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 0.1em;
    font-size: 1.1rem;
    padding: 0.6rem 1rem 0.5rem;
    border-radius: 8px 8px 0 0;
    border: 1px solid #ccc;
    border-bottom: 4px solid #1F2B8E;
    background: #ececec;
    color: #666;
    cursor: pointer;
    box-shadow: 2px -2px 5px rgba(0, 0, 0, 0.08);
    position: relative;
    bottom: -3px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

.bpda-tab-btn:hover {
    background: #f5f5f5;
    color: #1F2B8E;
}

.bpda-tab-btn.bpda-tab-active {
    background: #fff;
    color: #1F2B8E;
    border-color: #1F2B8E;
    border-bottom: 4px solid #FA9B1C;
    box-shadow: 2px -3px 6px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

/* Mobile dropdown — hidden on desktop */
.bpda-tab-select {
    display: none;
    width: 100%;
    padding: 0.75rem;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 0.08em;
    font-size: 1.1rem;
    border: none;
    background: transparent;
    color: #1F2B8E;
    cursor: pointer;
}

@media ( max-width: 640px ) {
    .bpda-tab-buttons { display: none; }
    .bpda-tab-select  { display: block; }
}

/* ---------------------------------------------------------
   Course block
   --------------------------------------------------------- */

.bpda-course {
    margin-bottom: 3.5rem;
}

.bpda-course-name {
    font-family: 'Bebas Neue', 'Nunito Sans', sans-serif !important;
    color: #1F2B8E !important;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

/* ---------------------------------------------------------
   Course header (day / dates / time / zoom)
   --------------------------------------------------------- */

.bpda-course-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.6rem 1rem;
    background: #f5f7ff;
    border-left: 4px solid #1F2B8E;
    border-radius: 0 4px 4px 0;
    font-size: 0.9rem;
}

.bpda-course-meta,
.bpda-zoom-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
}

.bpda-meta-item { color: #333; }

.bpda-zoom-link {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #1F2B8E;
    color: #fff !important;
    border-radius: 3px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
}
.bpda-zoom-link:hover { background: #001C4C; }

/* ---------------------------------------------------------
   Tooltip
   --------------------------------------------------------- */

.bpda-tooltip-wrap {
    position: relative;
    display: inline-block;
    margin-left: 5px;
    vertical-align: middle;
}

.bpda-tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #1F2B8E;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    font-family: sans-serif;
    letter-spacing: 0;
    line-height: 1;
}

.bpda-tooltip-text {
    display: none;
    position: absolute;
    bottom: calc( 100% + 6px );
    left: 50%;
    transform: translateX( -50% );
    background: #222;
    color: #fff;
    padding: 9px 13px;
    border-radius: 5px;
    font-size: 0.78rem;
    white-space: normal;
    width: 260px;
    z-index: 200;
    line-height: 1.55;
    font-weight: 400;
    font-family: inherit;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    pointer-events: none;
}

.bpda-tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX( -50% );
    border: 6px solid transparent;
    border-top-color: #222;
}

.bpda-tooltip-wrap:hover .bpda-tooltip-text,
.bpda-tooltip-wrap:focus .bpda-tooltip-text,
.bpda-tooltip-wrap:focus-within .bpda-tooltip-text {
    display: block;
}

/* ---------------------------------------------------------
   Email copy field
   --------------------------------------------------------- */

.bpda-email-copy-block {
    margin-bottom: 1.25rem;
}

.bpda-email-copy-label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    color: #444;
}

.bpda-email-copy-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 700px;
}

.bpda-email-list {
    flex: 1;
    padding: 0.45rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    background: #fafafa;
    color: #333;
    min-width: 0;
}

.bpda-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    background: #1F2B8E;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
}
.bpda-copy-btn:hover { background: #001C4C; }

/* ---------------------------------------------------------
   Table
   --------------------------------------------------------- */

.bpda-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.75rem;
}

.bpda-roster-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    font-size: 0.875rem;
}

.bpda-roster-table th,
.bpda-roster-table td {
    border: 1px solid #d0d0d0;
    padding: 7px 10px;
    text-align: center;
    vertical-align: middle;
}

.bpda-roster-table thead th {
    background: #f5f5f5;
    font-weight: 600;
    font-size: 0.8rem;
    line-height: 1.3;
}

.bpda-roster-table tbody tr     { background: #fff; }
.bpda-roster-table tbody tr:hover { background: #fafafa; }

.bpda-col-participant,
.bpda-cell-participant {
    text-align: left;
    min-width: 150px;
    white-space: normal;
}

.bpda-col-contact,
.bpda-cell-contact {
    min-width: 140px;
    text-align: left;
    white-space: normal;
    word-break: break-all;
    font-size: 0.8rem;
}

.bpda-col-location,
.bpda-cell-location {
    min-width: 110px;
    text-align: left;
    white-space: normal;
}

.bpda-col-rel,
.bpda-cell-rel {
    min-width: 150px;
    text-align: left;
    white-space: normal;
}

.bpda-col-week { min-width: 62px; }

.bpda-week-date {
    display: block;
    font-weight: 400;
    font-size: 0.75em;
    color: #666;
    margin-top: 2px;
    white-space: nowrap;
}

.bpda-col-pct,
.bpda-cell-pct {
    min-width: 46px;
    font-weight: 600;
    color: #1F2B8E;
}

.bpda-col-notes,
.bpda-cell-notes {
    min-width: 200px;
    text-align: left;
    white-space: normal;
}

.bpda-attendance-check {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1F2B8E;
}

.bpda-notes-field {
    width: 100%;
    min-width: 180px;
    padding: 4px 6px;
    font-size: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 3px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
}
.bpda-notes-field:focus {
    outline: none;
    border-color: #1F2B8E;
    box-shadow: 0 0 0 2px rgba(31,43,142,0.15);
}

/* ---------------------------------------------------------
   Save actions
   --------------------------------------------------------- */

.bpda-course-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.bpda-save-btn { padding: 0.45rem 1.4rem; cursor: pointer; }

.bpda-save-status              { font-size: 0.9rem; }
.bpda-save-status.bpda-success { color: #2e7d32; }
.bpda-save-status.bpda-error   { color: #c62828; }

/* ---------------------------------------------------------
   Google Doc embed
   --------------------------------------------------------- */

.bpda-doc-embed {
    width: 100%;
    height: 80vh;
    min-height: 500px;
}

.bpda-doc-embed iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ---------------------------------------------------------
   Misc
   --------------------------------------------------------- */

.bpda-message {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    background: #f9f9f9;
    border: 1px solid #ddd;
}
.bpda-message.bpda-error {
    background: #fff4f4;
    border-color: #f5c2c2;
    color: #c62828;
}
.bpda-admin-notice {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1.5rem;
}

/* ---------------------------------------------------------
   Notes popup
   --------------------------------------------------------- */

.bpda-notes-popup {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
}

.bpda-notes-popup.bpda-popup-hidden {
    display: none;
}

.bpda-notes-popup-inner {
    background: #fff;
    border-radius: 8px;
    padding: 1.75rem 2rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.bpda-notes-popup-inner p {
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333;
}

.bpda-notes-popup-inner a {
    color: #1F2B8E;
    text-decoration: underline;
}

.bpda-notes-popup-close {
    display: inline-block;
    padding: 0.5rem 1.75rem;
    background: #1F2B8E;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.bpda-notes-popup-close:hover {
    background: #001C4C;
}

/* Future weeks — subtle visual de-emphasis */
.bpda-future-week {
    background: #fafafa;
    opacity: 0.5;
}

/* Hidden tab sections — class toggled by JS, preserves Divi's native display */
.bpda-tab-section.bpda-tab-hidden {
    display: none !important;
}

/* ---------------------------------------------------------
   Withdrawn / No Show rows
   --------------------------------------------------------- */

.bpda-row-withdrawn {
    opacity: 0.5;
}

.bpda-row-withdrawn td {
    background: #f5f5f5;
}

.bpda-withdrawn-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 1px 6px;
    border-radius: 3px;
    background: #ccc;
    color: #555;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
}

.bpda-row-withdrawn .bpda-attendance-check,
.bpda-row-withdrawn .bpda-notes-field {
    cursor: not-allowed;
    pointer-events: none;
}

/* ---------------------------------------------------------
   No-show confirmation popup
   --------------------------------------------------------- */

.bpda-noshow-popup {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
}

.bpda-noshow-popup.bpda-popup-hidden {
    display: none;
}

.bpda-noshow-popup-inner {
    background: #fff;
    border-radius: 8px;
    padding: 1.75rem 2rem;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.bpda-noshow-popup-msg {
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333;
}

.bpda-noshow-popup-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.bpda-noshow-confirm,
.bpda-noshow-cancel {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.bpda-noshow-confirm {
    background: #c62828;
    color: #fff;
}

.bpda-noshow-confirm:hover {
    background: #a31f1f;
}

.bpda-noshow-cancel {
    background: #eee;
    color: #333;
}

.bpda-noshow-cancel:hover {
    background: #ddd;
}

/* ---------------------------------------------------------
   Sortable column headers
   --------------------------------------------------------- */

.bpda-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.bpda-sortable:hover {
    background: #eaeaea;
}

.bpda-sort-icon {
    display: inline-block;
    margin-left: 4px;
    opacity: 0.5;
    font-size: 0.8em;
}

.bpda-sortable[data-direction="asc"] .bpda-sort-icon,
.bpda-sortable[data-direction="desc"] .bpda-sort-icon,
.bpda-sortable[data-direction="first_name"] .bpda-sort-icon {
    opacity: 1;
    color: #1F2B8E;
}

/* ---------------------------------------------------------
   Sticky table headers
   --------------------------------------------------------- */

/*
 * --bpda-sticky-table-top is set dynamically by JS (header height + tab bar height).
 * The fallback of 120px covers most fixed-header + tab bar combinations.
 */
.bpda-roster-table thead th {
    position: sticky;
    top: var( --bpda-sticky-table-top, 120px );
    z-index: 10;
    /* Background must be explicit so content doesn't show through when scrolling */
    background: #f5f5f5;
}

/* ---------------------------------------------------------
   Admin / Staff: filter bar + accordion
   --------------------------------------------------------- */

.bpda-admin-courses {
    margin-bottom: 2rem;
}

.bpda-admin-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    max-width: 600px;
}

.bpda-course-filter-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
}

.bpda-course-filter-btn {
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    white-space: nowrap;
}

.bpda-course-filter-clear {
    background: none;
    border: none;
    color: #999;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.5rem 0.25rem;
    text-decoration: underline;
}
.bpda-course-filter-clear:hover { color: #555; }

/* Accordion */

.bpda-accordion {
    border-top: 1px solid #ddd;
}

.bpda-accordion-item {
    border-bottom: 1px solid #ddd;
}

.bpda-accordion-item[style*="display: none"] {
    display: none !important;
}

.bpda-accordion-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    background: #f9f9f9;
    border: none;
    cursor: pointer;
    font-family: 'Bebas Neue', 'Nunito Sans', sans-serif;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    color: #1F2B8E;
    text-align: left;
    transition: background 0.15s;
}

.bpda-accordion-header:hover {
    background: #f0f0f0;
}

.bpda-accordion-item.bpda-accordion-open .bpda-accordion-header {
    background: #eef0fb;
}

.bpda-accordion-icon {
    font-size: 0.7em;
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-left: 0.75rem;
}

.bpda-accordion-item.bpda-accordion-open .bpda-accordion-icon {
    transform: rotate(180deg);
}

.bpda-accordion-content {
    display: none;
    padding: 0.5rem 0 1rem;
}
