/* DSH Customer Overview [dsh_customer_overview]
 * Built from the tennis admin pieces: cards like .dsh-setup-card, icon boxes like .dsh-card-icon / .dsh-summary-icon,
 * labels like .dsh-card-label, filter pills like .dsh-date-pill, the mail button like .dsh-setup-save-btn. */

.dsh-co {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--dsh-text, #333);
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 80px;
}

.dsh-co * {
    box-sizing: border-box;
}

.dsh-co .material-symbols-outlined {
    font-size: 20px;
    line-height: 1;
    vertical-align: middle;
}

.dsh-co-denied {
    text-align: center;
    padding: 40px;
    color: var(--dsh-primary, #c12831);
    font-weight: 700;
}

/* Header */
.dsh-co-header {
    margin-bottom: 32px;
}

.dsh-co-kicker {
    display: block;
    margin-bottom: 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--dsh-primary, #c12831);
}

.dsh-co .dsh-co-title {
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    color: var(--dsh-dark, #1a1a1a);
}

/* Stat cards */
.dsh-co-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dsh-co-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px;
    background: var(--dsh-bg-light, #f8f8f8);
    border: 1px solid var(--dsh-border, #e5e5e5);
    border-radius: 24px;
}

.dsh-co-stat.is-highlight {
    grid-column: 1 / -1;
    color: #fff;
    background: var(--dsh-charity-gradient, linear-gradient(135deg, #c12831 0%, #d4a853 100%));
    border: none;
    box-shadow: 0 8px 25px rgba(193, 40, 49, 0.25);
}

/* Icon box left, label right; the box fixes the header height, so every value starts at the same line. */
.dsh-co-stat-header {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.dsh-co-stat-icon {
    display: flex;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--dsh-primary, #c12831);
    background: var(--dsh-bg, #fff);
    border-radius: 12px;
}

.dsh-co-stat.is-highlight .dsh-co-stat-icon {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}

/* Short line height: a label on two lines stays within the 44px header, so the values stay aligned. */
.dsh-co-stat-label {
    min-width: 0;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 1px;
    text-align: right;
    text-transform: uppercase;
    color: var(--dsh-text-light, #666);
}

.dsh-co-stat-value {
    font-family: var(--dsh-font-heading, 'Poppins', sans-serif);
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--dsh-dark, #1a1a1a);
}

.dsh-co-stat-note {
    font-size: 12px;
    color: var(--dsh-text-light, #666);
}

.dsh-co-stat.is-highlight .dsh-co-stat-label,
.dsh-co-stat.is-highlight .dsh-co-stat-note,
.dsh-co-stat.is-highlight .dsh-co-stat-value {
    color: #fff;
}

.dsh-co-stat.is-highlight .dsh-co-stat-value {
    font-size: 36px;
}

.dsh-co-stat.is-pending .dsh-co-stat-value {
    color: #b45309;
}

.dsh-co-stat.is-failed .dsh-co-stat-value {
    color: var(--dsh-primary, #c12831);
}

/* The total spans the full width; the other four share one row only where icon and label fit side by side. */
@media (min-width: 1024px) {
    .dsh-co-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Toolbar */
.dsh-co-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.dsh-co-search {
    position: relative;
    flex: 1 1 260px;
    margin: 0;
}

.dsh-co-search .material-symbols-outlined {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--dsh-text-light, #666);
    pointer-events: none;
}

.dsh-co .dsh-co-search-input {
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 12px 16px 12px 44px;
    font-size: 14px;
    background: var(--dsh-bg, #fff);
    border: 1px solid var(--dsh-border, #e5e5e5);
    border-radius: 12px;
}

.dsh-co .dsh-co-search-input:focus {
    outline: none;
    border-color: var(--dsh-primary, #c12831);
    box-shadow: 0 0 0 3px rgba(193, 40, 49, 0.15);
}

/* Filter pills: look like the tennis date pills, but wrap instead of scrolling. A scroll container would clip the
 * theme's 1px hover lift on buttons and hide the last pill on phones. */
.dsh-co-filters {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.dsh-co .dsh-co-filter {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 8px;
    align-items: center;
    margin: 0;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: normal;
    text-transform: none;
    color: var(--dsh-text-light, #666);
    background: var(--dsh-bg-light, #f8f8f8);
    border: none;
    border-radius: 30px;
    box-shadow: none;
    cursor: pointer;
    transition: all 0.2s;
}

.dsh-co .dsh-co-filter.is-active {
    color: var(--dsh-primary, #c12831);
    background: rgba(193, 40, 49, 0.1);
}

.dsh-co-filter span {
    min-width: 22px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 20px;
}

.dsh-co-filter.is-active span {
    background: rgba(193, 40, 49, 0.12);
}

.dsh-co-sort {
    flex: 0 0 auto;
    min-width: 230px;
}

.dsh-co-count {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--dsh-text-light, #666);
}

/* Customer list */
.dsh-co .dsh-co-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dsh-co-customer {
    margin: 0;
    background: var(--dsh-bg, #fff);
    border: 1px solid var(--dsh-border, #e5e5e5);
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.dsh-co-customer[hidden],
.dsh-co-detail[hidden],
.dsh-co-none[hidden] {
    display: none;
}

.dsh-co-customer.is-open {
    border-color: var(--dsh-primary, #c12831);
}

.dsh-co-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-right: 16px;
}

.dsh-co .dsh-co-toggle {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    min-width: 0;
    margin: 0;
    padding: 16px;
    font: inherit;
    letter-spacing: normal;
    text-align: left;
    text-transform: none;
    color: inherit;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
}

/* Avatar: same box as the tennis summary icons */
.dsh-co-avatar {
    display: flex;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 14px;
    font-weight: 800;
    color: var(--dsh-primary, #c12831);
    background: rgba(193, 40, 49, 0.08);
    border-radius: 12px;
}

.dsh-co-ident {
    display: flex;
    flex: 1 1 180px;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dsh-co-name {
    font-family: var(--dsh-font-heading, 'Poppins', sans-serif);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--dsh-dark, #1a1a1a);
}

.dsh-co-email {
    overflow: hidden;
    font-size: 13px;
    color: var(--dsh-text-light, #666);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dsh-co-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dsh-co-badge {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    border-radius: 20px;
}

.dsh-co-badge.is-guest {
    color: var(--dsh-text-light, #666);
    background: var(--dsh-bg-light, #f8f8f8);
}

.dsh-co-badge.is-active {
    color: #00743a;
    background: #dcfce7;
}

.dsh-co-badge.is-pending {
    color: #92400e;
    background: #fef3c7;
}

.dsh-co-badge.is-failed {
    color: var(--dsh-primary, #c12831);
    background: rgba(193, 40, 49, 0.1);
}

.dsh-co-sum {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: auto;
    font-family: var(--dsh-font-heading, 'Poppins', sans-serif);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--dsh-dark, #1a1a1a);
    white-space: nowrap;
}

.dsh-co-sum small {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: normal;
    color: var(--dsh-text-light, #666);
}

.dsh-co .dsh-co-chevron {
    font-size: 24px;
    color: var(--dsh-text-light, #666);
    transition: transform 0.2s;
}

.dsh-co-customer.is-open .dsh-co-chevron {
    transform: rotate(180deg);
}

/* Mail button: the secondary button of the tennis admin (.dsh-setup-save-btn) */
.dsh-co .dsh-co-mail {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 6px;
    align-items: center;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    color: var(--dsh-primary, #c12831);
    background: var(--dsh-bg-light, #f8f8f8);
    border: 1px solid var(--dsh-border, #e5e5e5);
    border-radius: 12px;
    transition: all 0.2s;
}

/* Detail view */
.dsh-co-detail {
    padding: 4px 16px 20px;
    background: var(--dsh-bg-light, #f8f8f8);
    border-top: 1px solid var(--dsh-border, #e5e5e5);
}

.dsh-co-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding: 12px 0 4px;
    font-size: 13px;
}

.dsh-co-meta > * {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.dsh-co .dsh-co-meta a {
    color: var(--dsh-primary, #c12831);
    text-decoration: none;
}

.dsh-co .dsh-co-meta .material-symbols-outlined {
    font-size: 18px;
}

.dsh-co .dsh-co-detail-title {
    margin: 20px 0 10px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--dsh-text-light, #666);
}

.dsh-co-empty {
    margin: 0;
    font-size: 13px;
    color: var(--dsh-text-light, #666);
}

.dsh-co .dsh-co-table {
    width: 100%;
    margin: 0;
    font-size: 13px;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--dsh-bg, #fff);
    border: 1px solid var(--dsh-border, #e5e5e5);
    border-radius: 16px;
    overflow: hidden;
}

.dsh-co .dsh-co-table th,
.dsh-co .dsh-co-table td {
    padding: 10px 14px;
    text-align: left;
    vertical-align: middle;
    border: none;
    border-bottom: 1px solid var(--dsh-border, #e5e5e5);
}

.dsh-co .dsh-co-table th {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--dsh-text-light, #666);
    background: var(--dsh-bg, #fff);
}

.dsh-co .dsh-co-table tbody tr:last-child td {
    border-bottom: none;
}

.dsh-co .dsh-co-table a {
    font-weight: 700;
    color: var(--dsh-primary, #c12831);
    text-decoration: none;
}

.dsh-co .dsh-co-table tr.is-pending td {
    background: #fffbeb;
}

.dsh-co .dsh-co-table tr.is-failed td {
    background: rgba(193, 40, 49, 0.05);
}

/* With a filter active, the matching orders stand out and the other orders fade back. */
.dsh-co.is-filter-pending .dsh-co-table.is-orders tbody tr:not(.is-pending),
.dsh-co.is-filter-failed .dsh-co-table.is-orders tbody tr:not(.is-failed) {
    opacity: 0.55;
}

.dsh-co-tag {
    display: inline-block;
    margin-left: 4px;
    padding: 2px 8px;
    font-size: 10px;
    color: var(--dsh-text-light, #666);
    background: var(--dsh-bg-light, #f8f8f8);
    border-radius: 20px;
}

.dsh-co-refund {
    display: block;
    color: var(--dsh-primary, #c12831);
}

.dsh-co-status {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--dsh-text-light, #666);
    background: var(--dsh-bg-light, #f8f8f8);
    border-radius: 20px;
}

.dsh-co-status.is-completed,
.dsh-co-status.is-processing,
.dsh-co-status.is-active {
    color: #00743a;
    background: #dcfce7;
}

.dsh-co-status.is-pending,
.dsh-co-status.is-on-hold,
.dsh-co-status.is-pending-cancel {
    color: #92400e;
    background: #fef3c7;
}

.dsh-co-status.is-failed {
    color: var(--dsh-primary, #c12831);
    background: rgba(193, 40, 49, 0.1);
}

.dsh-co-none {
    padding: 40px;
    text-align: center;
    color: var(--dsh-text-light, #666);
}

@media (hover: hover) and (pointer: fine) {
    .dsh-co .dsh-co-filter:hover {
        color: var(--dsh-primary, #c12831);
    }

    .dsh-co .dsh-co-toggle:hover .dsh-co-name {
        color: var(--dsh-primary, #c12831);
    }

    .dsh-co .dsh-co-mail:hover {
        color: #fff;
        background: var(--dsh-primary, #c12831);
        border-color: var(--dsh-primary, #c12831);
        box-shadow: 0 8px 20px rgba(193, 40, 49, 0.25);
    }
}

@media (max-width: 768px) {
    .dsh-co .dsh-co-title {
        font-size: 26px;
    }

    .dsh-co-stat {
        padding: 16px;
    }

    /* Half a phone screen is too narrow for icon and label side by side: label goes below the icon. */
    .dsh-co-stat-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 4px;
    }

    .dsh-co-stat-label {
        text-align: left;
    }

    .dsh-co-stat-value {
        font-size: 24px;
    }

    .dsh-co-stat.is-highlight .dsh-co-stat-value {
        font-size: 32px;
    }

    .dsh-co-search,
    .dsh-co-filters,
    .dsh-co-sort {
        flex: 1 1 100%;
    }

    .dsh-co-row {
        align-items: flex-start;
        padding-right: 12px;
    }

    .dsh-co .dsh-co-toggle {
        padding: 14px 12px;
    }

    .dsh-co .dsh-co-chevron {
        display: none;
    }

    .dsh-co .dsh-co-mail {
        margin-top: 14px;
        padding: 10px;
    }

    .dsh-co .dsh-co-mail span:last-child {
        display: none;
    }

    /* The tables become stacked rows with the column name in front of each value. */
    .dsh-co .dsh-co-table,
    .dsh-co .dsh-co-table tbody,
    .dsh-co .dsh-co-table tr,
    .dsh-co .dsh-co-table td {
        display: block;
        width: 100%;
    }

    .dsh-co .dsh-co-table thead {
        display: none;
    }

    .dsh-co .dsh-co-table tr {
        padding: 6px 0;
        border-bottom: 1px solid var(--dsh-border, #e5e5e5);
    }

    .dsh-co .dsh-co-table tbody tr:last-child {
        border-bottom: none;
    }

    .dsh-co .dsh-co-table td {
        display: flex;
        gap: 12px;
        padding: 4px 12px;
        border-bottom: none;
    }

    .dsh-co .dsh-co-table td::before {
        content: attr(data-label);
        flex: 0 0 110px;
        font-size: 10px;
        font-weight: 800;
        letter-spacing: 1px;
        text-transform: uppercase;
        color: var(--dsh-text-light, #666);
    }
}
