/* Insights & Data Sharing hub — table views for shoppers and org managers (Phase 2.9 / 3.0) */

body.data-sharing-page {
    background: #fff;
}

.data-sharing-page .container {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: var(--page-padding-top, 100px);
    padding-left: 1rem;
    padding-right: 1rem;
    padding-bottom: 3rem;
}

.ds-page-header {
    margin-bottom: 1.25rem;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border: 2px solid #f9d71c;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ds-page-header h1 {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: #222;
}

.ds-page-header p {
    margin: 0;
    color: #444;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.55;
    max-width: none;
    width: 100%;
}

.ds-page-header p + p {
    margin-top: 0.65rem;
}

.ds-page-header .ds-page-header-note {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

.ds-page-header .ds-page-header-note a {
    color: #333;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ds-page-header .ds-page-header-note a:hover {
    color: #000;
}

.ds-summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: center;
    padding: 0.85rem 1.15rem;
    margin-bottom: 1rem;
    background: #fff;
    border: 2px solid #f9d71c;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #2e7d32;
}

.ds-summary-bar--muted {
    background: #fff;
    border: 2px solid #f9d71c;
    color: #555;
}

.ds-summary-bar strong {
    font-weight: 700;
}

.ds-filter-section {
    margin-bottom: 1rem;
    padding: 1.15rem 1.25rem;
    background: #fff;
    border-radius: 10px;
    border: 2px solid #f9d71c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ds-filter-section h2 {
    margin: 0 0 0.85rem;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.ds-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: flex-end;
}

.ds-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 160px;
}

.ds-filter-group label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
}

.ds-filter-group select,
.ds-filter-group input[type="text"] {
    padding: 8px 12px;
    border: 2px solid #17a2b8;
    border-radius: 6px;
    background: #fff;
    font-size: 0.9rem;
    min-width: 180px;
}

.ds-filter-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ds-results-section {
    border: 2px solid #f9d71c;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ds-results-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    font-size: 0.875rem;
    color: #555;
}

.ds-table-wrap {
    overflow-x: auto;
    max-height: min(70vh, 720px);
    overflow-y: auto;
    /* Match Create request width (toolbar content box) */
    padding: 0 1rem 0.75rem;
    box-sizing: border-box;
}

.data-sharing-page .ds-sharing-table {
    font-size: 0.85rem;
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.data-sharing-page .ds-sharing-table th,
.data-sharing-page .ds-sharing-table td {
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: none;
    vertical-align: top;
    padding: 10px 8px;
    height: auto;
    min-height: 44px;
}

.data-sharing-page .ds-sharing-table th {
    background: #17a2b8;
    color: #fff;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: normal;
    line-height: 1.25;
    font-size: 0.75rem;
}

.data-sharing-page .ds-sharing-table th:nth-child(1),
.data-sharing-page .ds-sharing-table td:nth-child(1),
.data-sharing-page .ds-sharing-table th:nth-child(2),
.data-sharing-page .ds-sharing-table td:nth-child(2),
.data-sharing-page .ds-sharing-table th:nth-child(3),
.data-sharing-page .ds-sharing-table td:nth-child(3),
.data-sharing-page .ds-sharing-table th:nth-child(4),
.data-sharing-page .ds-sharing-table td:nth-child(4),
.data-sharing-page .ds-sharing-table th:nth-child(5),
.data-sharing-page .ds-sharing-table td:nth-child(5),
.data-sharing-page .ds-sharing-table th:nth-child(6),
.data-sharing-page .ds-sharing-table td:nth-child(6),
.data-sharing-page .ds-sharing-table th:nth-child(7),
.data-sharing-page .ds-sharing-table td:nth-child(7),
.data-sharing-page .ds-sharing-table th:nth-child(8),
.data-sharing-page .ds-sharing-table td:nth-child(8),
.data-sharing-page .ds-sharing-table th:nth-child(9),
.data-sharing-page .ds-sharing-table td:nth-child(9) {
    width: auto;
    min-width: 0;
}

.data-sharing-page .ds-sharing-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.data-sharing-page .ds-sharing-table tbody tr:hover {
    background: #f0f8ff;
}

.ds-cell-org {
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
}

.ds-cell-request {
    line-height: 1.35;
    word-break: break-word;
}

.ds-cell-request small {
    display: block;
    color: #888;
    font-weight: 400;
    margin-top: 0.15rem;
    white-space: normal;
}

.ds-status {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.ds-status--pending {
    background: #fff3cd;
    color: #856404;
}

.ds-status--accepted {
    background: #d4edda;
    color: #155724;
}

.ds-status--declined {
    background: #f8d7da;
    color: #721c24;
}

.ds-status--active {
    background: #cce5ff;
    color: #004085;
}

.ds-status--na {
    background: #e9ecef;
    color: #666;
}

.ds-payout {
    color: #0d6efd;
    font-weight: 500;
}

.ds-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Campaign Actions: Edit / Delete stacked, equal width */
.ds-actions--stack {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    min-width: 4.5rem;
    gap: 0.4rem;
}

.ds-actions--stack .ds-action-btn {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 0.4rem 0.55rem;
}

.ds-action-btn {
    padding: 0.3rem 0.55rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}

.ds-action-btn--accept {
    background: #28a745;
    color: #fff;
}

.ds-action-btn--accept:hover {
    background: #218838;
}

.ds-action-btn--decline {
    background: #fff;
    color: #dc3545;
    border-color: #dc3545;
}

.ds-action-btn--decline:hover {
    background: #fff5f5;
}

.ds-empty-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: #666;
}

.ds-empty-state a {
    color: #17a2b8;
    font-weight: 600;
}

.ds-error {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: #fff9e6;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    font-size: 0.9rem;
}

.ds-consent-note {
    margin-top: 1.5rem;
    padding: 1rem 1.15rem;
    background: #fff;
    border: 2px solid #f9d71c;
    border-radius: 10px;
    font-size: 0.875rem;
    color: #555;
    line-height: 1.5;
}

.ds-consent-note a {
    color: #17a2b8;
    font-weight: 600;
}

/* View tabs (shopper vs manager) */
.ds-view-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ds-view-tab {
    padding: 0.55rem 1rem;
    border: 2px solid #f9d71c;
    border-radius: 8px;
    background: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    color: #444;
    cursor: pointer;
}

.ds-view-tab:hover {
    background: #fffef5;
}

.ds-view-tab--active {
    background: #f9d71c;
    color: #222;
}

.ds-manager-org-label {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    color: #555;
    font-weight: 600;
}

.ds-create-campaign-btn {
    margin-left: auto;
    white-space: nowrap;
}

/* Primary CTA — make Create request easy to spot on the hub page */
.data-sharing-page #dsCreateCampaignBtn.ds-create-campaign-btn,
.data-sharing-page .ds-create-campaign-btn.btn-insight-requests {
    width: 100% !important;
    min-height: 52px !important;
    padding: 0.9rem 1.5rem !important;
    margin: 0.25rem 0 0 !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
    border-radius: 10px !important;
    border: 2px solid #1e7e34 !important;
    color: #fff !important;
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%) !important;
    box-shadow: 0 4px 14px rgba(40, 167, 69, 0.35) !important;
}

.data-sharing-page #dsCreateCampaignBtn.ds-create-campaign-btn:hover,
.data-sharing-page .ds-create-campaign-btn.btn-insight-requests:hover {
    background: linear-gradient(135deg, #34ce57 0%, #28a745 100%) !important;
    border-color: #19692c !important;
    box-shadow: 0 6px 18px rgba(40, 167, 69, 0.45) !important;
    transform: translateY(-1px) !important;
    color: #fff !important;
}

.ds-results-toolbar #dsCreateCampaignBtn {
    flex: 1 1 100%;
    order: 3;
}
.ds-status--draft {
    background: #e2e3e5;
    color: #383d41;
}

.ds-status--closed {
    background: #d1ecf1;
    color: #0c5460;
}

.ds-status--cancelled {
    background: #f8d7da;
    color: #721c24;
}

.ds-action-btn--edit {
    background: #fff;
    color: #856404;
    border-color: #f9d71c;
}

.ds-action-btn--edit:hover {
    background: #fffef5;
}

.ds-action-btn--view {
    background: #fff;
    color: #17a2b8;
    border-color: #17a2b8;
    margin-left: 0.35rem;
}

.ds-action-btn--view:hover {
    background: #f0fbfd;
}

.ds-campaign-metric {
    font-size: 0.8rem;
    color: #555;
    white-space: nowrap;
}

.ds-campaign-metric__pending {
    color: #856404;
    font-weight: 600;
}

.ds-cell-grants {
    white-space: nowrap;
}

.ds-campaign-grant-count {
    font-weight: 600;
}

.ds-participants-modal-content {
    max-width: 780px;
    width: 95%;
}

.ds-participants-note {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: #666;
}

.ds-participants-modal-content .ds-participants-table {
    width: 100%;
    min-width: 100%;
    font-size: 0.85rem;
}

.ds-participants-modal-content .ds-participants-table th,
.ds-participants-modal-content .ds-participants-table td {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    height: auto;
    min-height: 44px;
    vertical-align: middle;
}

.ds-participants-modal-content .ds-participants-table th {
    background: #17a2b8;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}

.ds-participants-modal-content .ds-participants-table th:nth-child(1),
.ds-participants-modal-content .ds-participants-table td:nth-child(1) {
    width: 140px;
    min-width: 140px;
    max-width: none;
}

.ds-participants-modal-content .ds-participants-table th:nth-child(2),
.ds-participants-modal-content .ds-participants-table td:nth-child(2) {
    width: 100px;
    min-width: 100px;
    max-width: none;
}

.ds-participants-modal-content .ds-participants-table th:nth-child(3),
.ds-participants-modal-content .ds-participants-table td:nth-child(3) {
    width: 90px;
    min-width: 90px;
    max-width: none;
}

.ds-participants-modal-content .ds-participants-table th:nth-child(4),
.ds-participants-modal-content .ds-participants-table td:nth-child(4) {
    width: 160px;
    min-width: 140px;
    max-width: none;
}

.ds-participants-modal-content .ds-participants-table th:nth-child(5),
.ds-participants-modal-content .ds-participants-table td:nth-child(5) {
    width: 100px;
    min-width: 100px;
    max-width: none;
    white-space: nowrap;
}

.ds-participants-modal-content .ds-participants-table th:nth-child(6),
.ds-participants-modal-content .ds-participants-table td:nth-child(6) {
    width: 110px;
    min-width: 100px;
    max-width: none;
}

/* Manager campaign table columns (10 cols) — fit Create request width */
.data-sharing-page .ds-sharing-table--campaigns th:nth-child(1),
.data-sharing-page .ds-sharing-table--campaigns td:nth-child(1),
.data-sharing-page .ds-sharing-table--campaigns th:nth-child(2),
.data-sharing-page .ds-sharing-table--campaigns td:nth-child(2),
.data-sharing-page .ds-sharing-table--campaigns th:nth-child(3),
.data-sharing-page .ds-sharing-table--campaigns td:nth-child(3),
.data-sharing-page .ds-sharing-table--campaigns th:nth-child(4),
.data-sharing-page .ds-sharing-table--campaigns td:nth-child(4),
.data-sharing-page .ds-sharing-table--campaigns th:nth-child(5),
.data-sharing-page .ds-sharing-table--campaigns td:nth-child(5),
.data-sharing-page .ds-sharing-table--campaigns th:nth-child(6),
.data-sharing-page .ds-sharing-table--campaigns td:nth-child(6),
.data-sharing-page .ds-sharing-table--campaigns th:nth-child(7),
.data-sharing-page .ds-sharing-table--campaigns td:nth-child(7),
.data-sharing-page .ds-sharing-table--campaigns th:nth-child(8),
.data-sharing-page .ds-sharing-table--campaigns td:nth-child(8),
.data-sharing-page .ds-sharing-table--campaigns th:nth-child(9),
.data-sharing-page .ds-sharing-table--campaigns td:nth-child(9),
.data-sharing-page .ds-sharing-table--campaigns th:nth-child(10),
.data-sharing-page .ds-sharing-table--campaigns td:nth-child(10) {
    width: auto;
    min-width: 0;
}

.my-account-ds-link {
    margin-top: 0.75rem;
}

.my-account-ds-summary {
    margin: 0.75rem 0 0;
    font-size: 0.9rem;
    color: #666;
}

.nav-pending-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    margin-left: 0.35rem;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}

@media (max-width: 768px) {
    .ds-filter-group select,
    .ds-filter-group input[type="text"] {
        min-width: 100%;
    }

    .ds-filter-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Share List success modal (Phase 4 — tid) */
#tidShareSuccessModal {
    z-index: 6000;
}

.tid-share-modal-content {
    max-width: 28rem;
    padding: 1.5rem 1.75rem 1.35rem;
    border: 2px solid #f9d71c;
    border-radius: 12px;
}

.tid-share-modal-content h3 {
    margin: 0 0 0.65rem;
    font-size: 1.35rem;
    color: #222;
}

.tid-share-modal-lead {
    margin: 0 0 1rem;
    color: #444;
    font-size: 0.95rem;
    line-height: 1.5;
}

.tid-share-codes {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #fffef5;
    border: 1px solid #f9d71c;
    border-radius: 8px;
}

.tid-share-code-block {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tid-share-code-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #666;
}

.tid-share-pickup-code {
    font-size: 1.75rem;
    letter-spacing: 0.12em;
    color: #2e7d32;
}

.tid-share-trip-id {
    font-size: 0.8rem;
    word-break: break-all;
    color: #333;
    background: #f5f5f5;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
}

.tid-share-store-note {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    color: #555;
    line-height: 1.45;
}

.tid-share-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.tid-share-modal-actions .btn-primary {
    min-width: 5.5rem;
}

.dashboard-page .tid-share-modal-actions .btn-secondary {
    background: #fff;
    color: #333;
    border: 2px solid #f9d71c;
    font-weight: 600;
}

.dashboard-page .tid-share-modal-actions .btn-secondary:hover:not(:disabled) {
    background: #f9d71c;
    color: #222;
}

.tid-share-modal-message {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: #2e7d32;
    min-height: 1.25rem;
}
