/* GFA portal: phone rules.
   Loaded after gfa-dark.css. Everything here sits behind a phone-width media query so
   desktop layouts and dark mode stay untouched. Rules: form text 16px+, taps 44px+,
   main action visible without scrolling.
   Phase 1 (musicians: My Gigs card, gig page top card) 2026-11-13. */

/* Thumb-sized buttons, every width (these classes are only used on musician screens). */
.gfa-tap-btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    padding-left: 1rem;
    padding-right: 1rem;
}
.gfa-tap-btn.gfa-tap-icon {
    min-width: 48px;
}

@media (max-width: 767.98px) {
    /* Buttons in a tap row share the width; the icon-only calendar button keeps its size. */
    .gfa-tap-row .gfa-tap-btn:not(.gfa-tap-icon) {
        flex: 1 1 0;
    }

    /* Musician gig page: top card */
    .gfa-artist-top-card .card-body {
        padding: 1rem;
    }

    /* My Gigs cards: bigger header tap, no double border between header and actions */
    .gfa-gig-card .accordion-button {
        min-height: 56px;
        font-size: 1rem;
    }
    .gfa-gig-card .gfa-gig-actions {
        background: var(--bs-accordion-bg, var(--bs-body-bg));
    }

    /* Accept / Decline confirmation modals: 16px text, thumb-sized footer buttons */
    [id^="kt_modal_accept_event-"] .modal-footer,
    [id^="kt_modal_decline_event-"] .modal-footer,
    #gfa_modal_accept_gig .modal-footer,
    #gfa_modal_decline_gig .modal-footer {
        display: flex;
        gap: 0.5rem;
    }
    [id^="kt_modal_accept_event-"] .modal-footer .btn,
    [id^="kt_modal_decline_event-"] .modal-footer .btn,
    #gfa_modal_accept_gig .modal-footer .btn,
    #gfa_modal_decline_gig .modal-footer .btn {
        flex: 1 1 0;
        min-height: 48px;
        font-size: 1rem;
    }
}

/* ===== Phase 2: global phone pass (2026-11-13) =====
   Everything below sits behind a phone-width query; desktop and dark mode keep their rules. */
@media (max-width: 767.98px) {
    /* 1. Inputs: 16px stops iOS Safari zooming on focus (also inside modals and Select2). */
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),
    select,
    textarea,
    .form-control,
    .form-select,
    .select2-selection,
    .select2-search__field,
    .ql-editor {
        font-size: 16px !important;
    }
    .form-control:not(textarea),
    .form-select {
        min-height: 44px;
    }

    /* 2. Tap targets: 44px by padding, icons keep their size. */
    .btn.btn-sm,
    .btn.btn-icon.btn-sm,
    .page-link,
    .accordion-button,
    .event-accordion-toggle,
    .nav-link,
    .dropdown-item,
    .menu-link {
        min-height: 44px;
    }
    .btn.btn-sm,
    .page-link {
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .btn.btn-icon.btn-sm {
        width: 44px;
        height: 44px;
    }
    .form-check-input {
        width: 1.5rem;
        height: 1.5rem;
    }
    .form-check.form-switch .form-check-input {
        width: 3rem;
        height: 1.6rem;
    }

    /* 3. Text floor: nothing under 13px on a phone. */
    .fs-8,
    .fs-7,
    small,
    .badge,
    .text-muted {
        font-size: max(13px, 1em);
    }
    .fs-8 { font-size: 13px !important; }

    /* 4. Slimmer header: logo capped, empty toolbar band removed. */
    #kt_app_header img,
    #kt_app_header .logo-light,
    #kt_app_header .logo-dark {
        max-height: 36px;
        width: auto;
    }
    #kt_app_toolbar:empty {
        display: none;
    }
    #kt_app_toolbar {
        padding-top: 0.25rem !important;
        padding-bottom: 0.25rem !important;
        min-height: 0;
    }

    /* 5. Tables as cards. Opt in with class gfa-table-cards on the table and data-label on each td. */
    table.gfa-table-cards thead {
        display: none;
    }
    table.gfa-table-cards,
    table.gfa-table-cards tbody,
    table.gfa-table-cards tr,
    table.gfa-table-cards td {
        display: block;
        width: 100%;
    }
    table.gfa-table-cards tr {
        border: 1px solid var(--bs-border-color, #e4e6ef);
        border-radius: 0.75rem;
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.75rem;
    }
    table.gfa-table-cards td {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.35rem 0 !important;
        border: 0 !important;
        text-align: right;
    }
    table.gfa-table-cards td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--bs-gray-600, #7e8299);
        text-align: left;
        flex: 0 0 38%;
    }

    /* 6. Pinned action bar: <x-mobile-actions> keeps Save / Send within thumb reach. */
    .gfa-mobile-actions {
        position: sticky;
        bottom: 0;
        z-index: 90;
        display: flex;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom));
        margin: 1rem -0.75rem 0;
        background: var(--bs-body-bg, #fff);
        border-top: 1px solid var(--bs-border-color, #e4e6ef);
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    }
    .gfa-mobile-actions .btn {
        flex: 1 1 0;
        min-height: 48px;
        font-size: 1rem;
    }
}

/* Phone-only helper: hide on phones / show only on phones. */
@media (max-width: 767.98px) {
    .gfa-hide-phone { display: none !important; }
}
@media (min-width: 768px) {
    .gfa-phone-only { display: none !important; }
}

/* Phase 2: on phones the header scrolls with the page (static), but the theme still adds the
   60px fixed-header offset to the wrapper, leaving an empty band. Drop it unless the header is
   pinned on mobile. */
@media (max-width: 991.98px) {
    body:not([data-kt-app-header-fixed-mobile="true"]) #kt_app_wrapper {
        margin-top: 0 !important;
    }
}

/* ===== Phase 3A: staff gig page + events list ===== */
/* Events list: each status dot sits in a .gfa-dot wrapper with a phone-only label. From 768px up the wrapper
   has no box (display: contents), so the dots lay out exactly as before; dark mode's hairline moves to the dot. */
.event-status-indicators .gfa-dot {
    display: contents;
}
[data-bs-theme=dark] .event-status-indicators > .gfa-dot > .status-dot {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
}

@media (max-width: 767.98px) {
    /* --- Staff gig page (/events/{id}): tab bar under the title --- */
    .gfa-gig-tabs {
        position: sticky;
        top: 0;
        z-index: 95;
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0.5rem 0;
        margin-bottom: 0.75rem;
        background: var(--bs-app-bg-color, var(--bs-body-bg));
        border-bottom: 1px solid var(--bs-border-color);
    }
    .gfa-gig-tabs::-webkit-scrollbar {
        display: none;
    }
    .gfa-gig-tabs .btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    body[data-kt-app-header-fixed-mobile="true"] .gfa-gig-tabs {
        top: var(--bs-app-header-height, 60px);
    }
    /* Only the active tab's sections show. Sections are later siblings of the bar, tagged data-gfa-tab. */
    .gfa-gig-tabs[data-active="info"] ~ [data-gfa-tab]:not([data-gfa-tab="info"]),
    .gfa-gig-tabs[data-active="advance"] ~ [data-gfa-tab]:not([data-gfa-tab="advance"]),
    .gfa-gig-tabs[data-active="venue"] ~ [data-gfa-tab]:not([data-gfa-tab="venue"]),
    .gfa-gig-tabs[data-active="music"] ~ [data-gfa-tab]:not([data-gfa-tab="music"]),
    .gfa-gig-tabs[data-active="moments"] ~ [data-gfa-tab]:not([data-gfa-tab="moments"]),
    .gfa-gig-tabs[data-active="hiring"] ~ [data-gfa-tab]:not([data-gfa-tab="hiring"]),
    .gfa-gig-tabs[data-active="activity"] ~ [data-gfa-tab]:not([data-gfa-tab="activity"]) {
        display: none !important;
    }

    /* --- All Events list (/events, /events/old, /events/new): rows as cards --- */
    .gfa-events-filters > .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .gfa-events-filters > .col-6 + .col-6 {
        margin-top: 0.75rem;
    }
    .gfa-events-filters .gfa-events-date-col {
        flex-wrap: wrap;
    }
    .gfa-events-filters .gfa-events-filter-btn {
        width: 100%;
        min-height: 44px;
    }

    table.gfa-events-cards thead {
        display: none;
    }
    table.gfa-events-cards,
    table.gfa-events-cards tbody {
        display: block;
        width: 100%;
    }
    table.gfa-events-cards.border-bottom {
        border-bottom: 0 !important;
    }
    /* table.table + child combinators: beats Metronic's first/last-row padding and border resets. */
    table.table.gfa-events-cards > tbody > tr.events-list-clickable-row {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        border: 1px solid var(--bs-border-color) !important;
        border-radius: 0.75rem;
        padding: 0.85rem 0.9rem !important;
        margin-bottom: 0.75rem;
    }
    table.gfa-events-cards tr.events-list-clickable-row > td {
        display: block;
        width: auto;
        padding: 0 !important;
        border: 0 !important;
        white-space: normal;
        background: transparent;
    }
    table.gfa-events-cards .gfa-events-name-cell {
        order: 1;
    }
    table.gfa-events-cards .events-list-status-column {
        order: 2;
    }
    table.gfa-events-cards tr.events-list-clickable-row > td[data-label] {
        order: 3;
        display: flex;
        justify-content: space-between;
        gap: 1rem;
    }
    table.gfa-events-cards tr.events-list-clickable-row > td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--bs-gray-600);
    }
    .gfa-events-card-head {
        display: block;
        font-size: 1rem;
        line-height: 1.35;
    }
    .gfa-events-card-head .text-muted {
        font-size: 0.95rem;
    }

    /* Status dots with a one-word label next to each; the hiring light goes to the right. */
    table.gfa-events-cards .event-status-indicators {
        flex-wrap: wrap;
        gap: 0.45rem 0.9rem;
    }
    table.gfa-events-cards .event-status-indicators .gfa-dot {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
    }
    [data-bs-theme=dark] table.gfa-events-cards .event-status-indicators > .gfa-dot {
        box-shadow: none;
    }
    table.gfa-events-cards .event-status-indicators .gfa-dot-hiring {
        margin-left: auto;
    }
    table.gfa-events-cards .gfa-dot-label {
        font-size: 13px;
        color: var(--bs-gray-700);
        white-space: nowrap;
    }
}

/* ===== Phase 3B/5: CRM, messages, lists, forms ===== (2026-11-13)
   Phone rules only, except the hidden-by-default CRM "Move to" picker. */

/* CRM pipeline: per-card "Move to" picker exists in the markup but only shows on
   phones and touch screens under 992px (drag is awkward there). */
.crm-kb-moveto {
    display: none;
}
@media (max-width: 767.98px), (max-width: 991.98px) and (pointer: coarse) {
    .crm-jkanban .crm-kb-moveto {
        display: block;
        margin-top: 8px;
    }
    .crm-jkanban .crm-kb-moveto .form-select {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }
}

@media (max-width: 767.98px) {
    /* 1. CRM report: date pickers stacked full width; tables scroll sideways with the first column pinned. */
    .crm-report-filter {
        margin-bottom: 1rem;
    }
    .crm-report-filter .crm-row {
        flex-direction: column;
        gap: 8px;
    }
    .crm-report-filter .crm-row > div {
        width: 100%;
    }
    .crm-report-filter .crm-row .btn {
        width: 100%;
        min-height: 44px;
    }
    .crm-table-outer.crm-report-scroll {
        overflow-x: auto;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }
    .crm-report-scroll .crm-report-table th:first-child,
    .crm-report-scroll .crm-report-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        box-shadow: 1px 0 0 var(--crm-slate, var(--bs-border-color));
    }
    .crm-report-scroll .crm-report-table th:first-child {
        z-index: 2;
    }
    .crm-report-scroll .crm-report-table td:first-child {
        background: var(--bs-body-bg);
    }
    .crm-report-scroll .crm-report-table tr:nth-child(even) td:first-child {
        background: var(--crm-paper, var(--bs-gray-100));
    }

    /* 2. CRM pipeline: filter hints as a tap-to-open list (built by crm.js). */
    .crm-hint-help {
        width: 100%;
        font-size: 13px;
        color: var(--bs-gray-700);
    }
    .crm-hint-help summary {
        min-height: 44px;
        display: flex;
        align-items: center;
        cursor: pointer;
        font-weight: 600;
        color: var(--bs-primary);
    }
    .crm-hint-help ul {
        padding-left: 1.1rem;
        margin: 0 0 0.5rem;
    }
    .crm-hint-help li + li {
        margin-top: 0.25rem;
    }

    /* 4. Messages: On/Off switches and address chips at thumb size. */
    .gfa-msg .gfa-status-cell .form-check.form-switch {
        min-height: 44px;
        display: flex;
        align-items: center;
        margin: 0;
    }
    .gfa-msg .gfa-status-cell .form-check.form-switch .form-check-input {
        width: 3.25rem;
        height: 1.75rem;
    }
    .gfa-msg .gfa-status-cell .form-check.form-switch .form-check-label {
        padding: 0.75rem 0 0.75rem 0.5rem;
    }
    .gfa-msg .gfa-chips .gfa-chip {
        min-height: 44px;
        font-size: 0.9rem;
        padding-left: 0.85rem;
    }
    .gfa-msg .gfa-chips .gfa-chip button {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .gfa-msg .gfa-chips .gfa-chip-input {
        min-height: 44px;
    }

    /* 5. List cards. Metronic zeroes the first/last row padding and the row border on
       .table; give every card the same frame. */
    table.gfa-table-cards > tbody > tr {
        padding: 0.5rem 0.75rem !important;
        border: 1px solid var(--bs-border-color) !important;
    }
    table.gfa-table-cards.gfa-planners-table {
        padding: 0.75rem;
    }
    /* User roles: the user (avatar, name, email) heads the card without a label. */
    table.gfa-table-cards.gfa-users-table td[data-label="User"]::before {
        display: none;
    }
    table.gfa-table-cards.gfa-users-table td[data-label="User"] > div {
        min-width: 0;
        overflow-wrap: anywhere;
    }
    /* Long text wraps inside the card instead of widening it. */
    table.gfa-table-cards.venues-table td,
    table.gfa-table-cards.venues-table td:not(:first-child) {
        font-size: 13px !important;
        word-break: normal;
        overflow-wrap: anywhere;
    }
    table.gfa-table-cards.venues-table td span[style*="nowrap"] {
        white-space: normal !important;
    }
    table.gfa-table-cards.venues-table td.sticky-actions-col {
        position: static;
        box-shadow: none;
        background: transparent;
    }
    table.gfa-table-cards.gfa-planners-table td,
    table.gfa-table-cards.gfa-artist-table td {
        overflow-wrap: anywhere;
    }
    /* Artists: the Actions button opens its menu below, full width. */
    table.gfa-table-cards.gfa-artist-table td.invitation-buttons-cel {
        flex-wrap: wrap;
        background: transparent;
    }
    table.gfa-table-cards.gfa-artist-table td.invitation-buttons-cel > .collapse,
    table.gfa-table-cards.gfa-artist-table td.invitation-buttons-cel > .collapsing {
        flex: 0 0 100%;
    }
    table.gfa-table-cards.gfa-artist-table td.invitation-buttons-cel .btn {
        width: 100%;
    }
    table.gfa-table-cards.gfa-artist-table td.invitation-buttons-cel > .artist-actions-toggle {
        width: auto;
        flex: 1 1 auto;
    }
    /* Clients: filters stacked full width. */
    .card-toolbar.gfa-client-toolbar {
        width: 100%;
    }
    .gfa-client-filters {
        width: 100%;
        flex-direction: column;
        align-items: stretch !important;
    }
    .gfa-client-filters > *,
    .gfa-client-filters .form-select,
    .gfa-client-filters .form-control {
        width: 100% !important;
    }

    /* 7. General GFA Info: label above the value; long text clipped to 2 lines, tap to expand. */
    table.gfa-table-cards.gfa-info-table td {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
        gap: 0.25rem;
    }
    table.gfa-table-cards.gfa-info-table td[data-label]::before {
        flex: none;
    }
    table.gfa-table-cards.gfa-info-table td.sticky-actions-col {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .gfa-clamp-phone {
        flex: 1 1 auto;
        min-width: 0;
        cursor: pointer;
    }
    .gfa-clamp-phone:not(.is-open) {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        overflow: hidden;
    }

    /* 8. Charts: Open / Copy / Edit / Delete as a row of 44px buttons. */
    table.gfa-table-cards.gfa-charts-table td.gfa-chart-actions {
        width: 100% !important;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.5rem;
    }
    table.gfa-table-cards.gfa-charts-table td.gfa-chart-actions[data-label]::before {
        display: none;
    }
    table.gfa-table-cards.gfa-charts-table td.gfa-chart-actions .btn {
        min-width: 44px;
        min-height: 44px;
    }
    table.gfa-table-cards.gfa-charts-table td.gfa-chart-actions .btn.w-35px {
        width: 44px !important;
        height: 44px !important;
    }
    table.gfa-table-cards.gfa-charts-table td.gfa-chart-actions a.btn {
        flex: 1 1 auto;
    }
}

/* ===== Leftovers (todo 438): Messages page sections collapse on every screen; they start
   collapsed on phones and open on wider screens (todo 472.1, the open state is set in x-data) ===== */
.gfa-sec > .card-header { cursor: pointer; }
/* Wider screens: open until the header is clicked (open by default, even before Alpine starts). */
.gfa-sec.gfa-sec-closed > .card-body { display: none; }
.gfa-sec.gfa-sec-closed > .card-header { padding-bottom: 1.25rem; }
.gfa-sec-chev { display: inline-block; margin-left: 0.5rem; transition: transform .2s ease; color: var(--bs-gray-600); }
.gfa-sec-chev-solo { margin-left: auto; align-self: center; }
.gfa-sec.gfa-sec-open .gfa-sec-chev { transform: rotate(180deg); }
@media (max-width: 767.98px) {
    .gfa-sec > .card-header { min-height: 56px; }
    .gfa-sec:not(.gfa-sec-open) > .card-body { display: none; }
    .gfa-sec:not(.gfa-sec-open) > .card-header { padding-bottom: 1.25rem; }
}
