/* Frontend overrides for the [dofe_events] shortcode.
 * The bulk of the styling (grid + modal) comes from
 * osm-events-admin.css. */

.dofe-events-fe {
    max-width: 1100px;
    margin: 0 auto;
}

.dofe-events-fe-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.dofe-events-fe-header h2 {
    margin: 0;
}
.dofe-events-fe-logout {
    font-size: 14px;
}

.dofe-leader-login {
    max-width: 360px;
    margin: 20px auto;
    padding: 24px;
    background: #fff;
    border: 1px solid #d0d4d8;
    border-radius: 8px;
}
.dofe-leader-login h2 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 18px;
}
.dofe-leader-login label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}
.dofe-leader-login input[type=text],
.dofe-leader-login input[type=password] {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-weight: normal;
}
.dofe-leader-login p { margin: 0 0 14px; }
.dofe-leader-login .button {
    width: 100%;
    padding: 10px;
    font-size: 14px;
}
.dofe-leader-login .dofe-err {
    background: #fcebea;
    border: 1px solid #f3c2c0;
    color: #b32d2e;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 14px;
    font-size: 13px;
}

/* ============================================================
   Front-end styling for the ported Teams / Reports admin screens.
   WordPress core admin classes (.postbox, .button, table.widefat,
   form fields, .notice) aren't loaded on the public site, so they
   are provided here — scoped to the leader tab panels so nothing
   leaks into the surrounding theme.
   ============================================================ */
.dofe-tab-panel .wrap { margin: 0; max-width: none; }
.dofe-tab-panel .postbox {
    background: #fff; border: 1px solid #e2e4e7; border-radius: 10px;
    box-shadow: none; margin: 0 0 16px; padding: 0;
}
.dofe-tab-panel .postbox > .inside,
.dofe-tab-panel .postbox .inside { margin: 0; padding: 16px 18px; }
.dofe-tab-panel .postbox h2,
.dofe-tab-panel .postbox h3 { margin-top: 0; }

/* Buttons */
.dofe-tab-panel .button,
.dofe-tab-panel button.button,
.dofe-tab-panel a.button {
    display: inline-block; padding: 7px 14px; border: 1px solid #c3c4c7;
    border-radius: 6px; background: #f6f7f7; color: #1d2327; font-size: 14px;
    line-height: 1.3; cursor: pointer; text-decoration: none; vertical-align: middle;
}
.dofe-tab-panel .button:hover,
.dofe-tab-panel a.button:hover { background: #f0f0f1; border-color: #8c8f94; color: #1d2327; }
.dofe-tab-panel .button-primary {
    background: #2271b1; border-color: #2271b1; color: #fff;
}
.dofe-tab-panel .button-primary:hover { background: #135e96; border-color: #135e96; color: #fff; }
.dofe-tab-panel .button-small { padding: 3px 10px; font-size: 12px; }
.dofe-tab-panel .button-link-delete,
.dofe-tab-panel .button-link-delete:hover {
    background: none; border: none; color: #b32d2e; padding: 4px 6px; text-decoration: underline;
}

/* Form fields */
.dofe-tab-panel input[type=text],
.dofe-tab-panel input[type=email],
.dofe-tab-panel input[type=password],
.dofe-tab-panel input[type=search],
.dofe-tab-panel input[type=number],
.dofe-tab-panel input[type=date],
.dofe-tab-panel select,
.dofe-tab-panel textarea,
.dofe-tab-panel .regular-text {
    padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 14px; background: #fff; color: #1d2327; max-width: 100%;
    box-sizing: border-box; line-height: 1.3;
}
.dofe-tab-panel label { font-size: 14px; }

/* Tables */
.dofe-tab-panel table.widefat,
.dofe-tab-panel table.wp-list-table {
    width: 100%; border-collapse: collapse; background: #fff;
    border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; margin: 8px 0;
}
.dofe-tab-panel table.widefat th,
.dofe-tab-panel table.widefat td {
    text-align: left; padding: 9px 12px; border-bottom: 1px solid #eef0f2; font-size: 14px;
}
.dofe-tab-panel table.widefat thead th {
    background: #f6f7f7; font-size: 12px; text-transform: uppercase;
    letter-spacing: .04em; color: #50575e; font-weight: 600;
}
.dofe-tab-panel table.widefat.striped tbody tr:nth-child(odd),
.dofe-tab-panel table.striped tbody tr:nth-child(odd) { background: #fbfbfc; }

/* Notices */
.dofe-tab-panel .notice {
    padding: 10px 14px; border-radius: 6px; margin: 0 0 14px;
    border-left: 4px solid #72aee6; background: #f0f6fc;
}
.dofe-tab-panel .notice p { margin: 0; }
.dofe-tab-panel .notice-success { border-left-color: #00a32a; background: #ecfdf5; }
.dofe-tab-panel .notice-error,
.dofe-tab-panel .notice-warning { border-left-color: #d63638; background: #fef2f2; }

/* WP form-table layout (used by some report/filter blocks) */
.dofe-tab-panel .form-table { border-collapse: collapse; width: 100%; }
.dofe-tab-panel .form-table th {
    text-align: left; padding: 10px 12px 10px 0; vertical-align: top;
    font-size: 14px; font-weight: 600; width: 180px;
}
.dofe-tab-panel .form-table td { padding: 10px 0; }

/* Teams tab — keep the add-team form compact on the narrower front-end column */
.dofe-tab-panel .osm-dofe-create-grid { grid-template-columns: 1fr; gap: 16px; }
.dofe-tab-panel .osm-dofe-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dofe-tab-panel .osm-dofe-section-card .inside { padding: 16px; }
.dofe-tab-panel .osm-dofe-teams-layout { max-width: 100%; }
@media (max-width: 560px) {
    .dofe-tab-panel .osm-dofe-form-grid { grid-template-columns: 1fr; }
}

/* Reports tab — clean stat tiles instead of raw postboxes */
.dofe-tab-panel .osm-dofe-report-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.dofe-tab-panel .osm-dofe-report-card {
    background: #fff; border: 1px solid #e2e4e7; border-radius: 10px;
    padding: 16px 18px; margin: 0; box-shadow: none;
    display: flex; flex-direction: column; gap: 6px;
}
.dofe-tab-panel .osm-dofe-report-card-label {
    font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    color: #6b7280; margin: 0; font-weight: 600;
}
.dofe-tab-panel .osm-dofe-report-card-value { font-size: 26px; font-weight: 700; line-height: 1; color: #1d2327; }
@media (max-width: 782px) {
    .dofe-tab-panel .osm-dofe-report-two-col { grid-template-columns: 1fr; }
}

/* Member Records — filter bar. Fields grow/shrink together instead of one
   getting squeezed down to a wrapped 3-line label on narrow screens. */
.dofe-tab-panel .dofe-mr-filters {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 14px 0;
}
.dofe-tab-panel .dofe-mr-filters > p {
    margin: 0; flex: 1 1 150px; min-width: 140px;
}
.dofe-tab-panel .dofe-mr-filters label { white-space: nowrap; }
.dofe-tab-panel .dofe-mr-filters select,
.dofe-tab-panel .dofe-mr-filters input[type=search] { width: 100%; }
.dofe-tab-panel .dofe-mr-filters .dofe-mr-filter-checkbox {
    display: flex; align-items: center; flex: 1 1 220px;
}
.dofe-tab-panel .dofe-mr-filters .dofe-mr-filter-checkbox label {
    display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.dofe-tab-panel .dofe-mr-filters .dofe-mr-filter-actions {
    display: flex; gap: 8px; flex: 0 0 auto;
}
@media (max-width: 560px) {
    .dofe-tab-panel .dofe-mr-filters > p { flex-basis: 100%; }
}

/* Member Records — the list table has ~11 columns (identity, 5 section dots,
   warnings, 3 log badges). table.widefat forces width:100% globally, which
   crushed all those columns into the viewport instead of letting the table
   size to its content — so it's excluded from that and given its own
   scrollable box instead (both directions, one shared scrollbar rather than
   two independently-scrolling areas, which was confusing).
   Sticky column headers: border-collapse:collapse (set globally on
   table.widefat) silently breaks position:sticky on <th> in every major
   browser, so this table overrides to border-collapse:separate with zero
   spacing — same visual result, but sticky actually works. A bounded height
   (rather than "no limit") is what makes the sticky header reliable across
   browsers — sized generously so most rosters need little/no scrolling. */
.dofe-tab-panel .dofe-mr-table-wrap {
    margin: 8px 0; max-height: 80vh;
    border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden;
}
.dofe-tab-panel .dofe-mr-table-wrap .dofe-mr-table-scroll {
    overflow: auto; -webkit-overflow-scrolling: touch; max-height: 80vh;
}
.dofe-tab-panel .dofe-mr-table-wrap .dofe-mr-table {
    width: auto; margin: 0;
    border-collapse: separate; border-spacing: 0; overflow: visible;
    border: none; border-radius: 0;
}
.dofe-tab-panel .dofe-mr-table-wrap .dofe-mr-table thead th {
    position: sticky; top: 0; z-index: 2; white-space: nowrap;
    box-shadow: 0 1px 0 #e5e7eb;
}

/* ============================================================
   Mobile: make every tab's wide content usable on a phone.
   - widefat data tables (Teams / Reports / Leaders) scroll
     horizontally instead of overflowing the layout.
   - filter button rows (Events / Members year + award) scroll
     horizontally instead of wrapping into a messy stack.
   (The route-card editor and Quartermaster tables already have
   their own scroll wrappers, so they aren't touched here.)
   ============================================================ */
@media (max-width: 782px) {
    .dofe-tab-panel table.widefat {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .dofe-tab-panel table.widefat thead th,
    .dofe-tab-panel table.widefat tbody td {
        white-space: nowrap;
    }
    /* Leaders table: let the action chips + area pills still wrap inside their cells */
    .dofe-tab-panel table.lt td.areas-cell,
    .dofe-tab-panel table.lt .led-actions { white-space: normal; }

    .dofe-tab-panel .osm-dofe-section-card .inside,
    .dofe-tab-panel .postbox .inside { padding: 14px; }
}

@media (max-width: 600px) {
    .dofe-tab-panel .dofe-events-filter,
    .dofe-tab-panel .dofe-patrols-filter,
    .dofe-tab-panel .dofe-patrols-year-filter {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .dofe-tab-panel .dofe-events-filter::-webkit-scrollbar,
    .dofe-tab-panel .dofe-patrols-filter::-webkit-scrollbar,
    .dofe-tab-panel .dofe-patrols-year-filter::-webkit-scrollbar { display: none; }
    .dofe-tab-panel .dofe-events-filter-btn { flex-shrink: 0; }

    /* Report stat tiles: two-up on small screens rather than cramped auto-fit */
    .dofe-tab-panel .osm-dofe-report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
