.ectw-csv-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.ectw-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
}

/* Inputs */
.ectw-table-search,
.ectw-date-filter {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    max-width: 260px;
    font-size: 14px;
    box-sizing: border-box;
    background-color: #fff;
}

.ectw-table-search:focus,
.ectw-date-filter:focus {
    outline: none;
    border-color: #374151;
    box-shadow: 0 0 0 1px rgba(194, 24, 91, 0.15);
}

.ectw-date-filter {
    -webkit-appearance: none;
    appearance: none;
    height: 36px;
    line-height: 1.2;
}

/* Status filter buttons */
.ectw-status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Softer, brand-colored buttons */
.ectw-status-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid #e5b5c8;
    background: #ffffff;
    font-size: 12px;
    cursor: pointer;
    box-sizing: border-box;
    color: #374151;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ectw-status-btn:hover {
    background: #fbe5f0;
    border-color: #374151;
}

/* Active state – subtle fill instead of hard outline */
.ectw-status-btn-active {
    background: #fde7f1 !important;
    border-color: #374151 !important;
    box-shadow: 0 0 0 1px rgba(194, 24, 91, 0.18);
}

/* Little color squares */
.ectw-status-color {
    width: 14px;
    height: 14px;
    display: inline-block;
    border-radius: 2px;
    border: 1px solid #d1d5db;
    box-sizing: border-box;
}

/* Legend colors in filter buttons */
.ectw-status-color-upcoming {
    background: #f3e5f5;      /* soft lilac */
    border-color: #e1bee7;
}

.ectw-status-color-inprogress {
    background: #e3f2fd;      /* soft blue */
    border-color: #bbdefb;
}

.ectw-status-color-finished {
    background: #e8f5e9;      /* soft green */
    border-color: #c8e6c9;
}

/* Table */
.ectw-csv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

/* reset any theme/zebra backgrounds */
.ectw-csv-table tr,
.ectw-csv-table td,
.ectw-csv-table tbody tr:nth-child(odd),
.ectw-csv-table tbody tr:nth-child(even) {
    background: transparent;
}

.ectw-csv-table th,
.ectw-csv-table td {
    border: 1px solid #e0e0e0;
    padding: 6px 8px;
}

/* Clear header, different from filters */
.ectw-csv-table th {
    background: #e9edf5;
    font-weight: 600;
    color: #333;
}

/* Row backgrounds by status – pastel colors
   Apply to both tr AND td so it works on mobile cards too */
.ectw-csv-table tr.ectw-status-upcoming,
.ectw-csv-table tr.ectw-status-upcoming td {
    background: #f9f1fb;      /* very light lilac */
}

.ectw-csv-table tr.ectw-status-inprogress,
.ectw-csv-table tr.ectw-status-inprogress td {
    background: #f1f7ff;      /* very light blue */
}

.ectw-csv-table tr.ectw-status-finished,
.ectw-csv-table tr.ectw-status-finished td {
    background: #f2fbf4;      /* very light green */
}

/* Hover – just slightly darker, keep status color */
.ectw-csv-table tbody tr:hover {
    filter: brightness(0.96);
}

/* ---------- Mobile card layout + smaller controls ---------- */
@media (max-width: 768px) {

    .ectw-csv-table-wrapper {
        overflow-x: visible;
    }

    .ectw-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .ectw-table-search,
    .ectw-date-filter {
        max-width: 100%;
        width: 100%;
        font-size: 14px;
        height: 38px;
    }

    .ectw-status-filters {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .ectw-status-btn {
        padding: 3px 6px;
        font-size: 11px;
    }

    .ectw-csv-table,
    .ectw-csv-table thead,
    .ectw-csv-table tbody,
    .ectw-csv-table th,
    .ectw-csv-table tr,
    .ectw-csv-table td {
        display: block;
    }

    .ectw-csv-table thead {
        display: none;
    }

    .ectw-csv-table tr {
        border: 1px solid #e0e0e0;
        margin-bottom: 10px;
        /* IMPORTANT: no background here – status classes will color it */
        background: transparent;
    }

    .ectw-csv-table td {
        border: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 6px 10px;
        font-size: 14px;
    }

    .ectw-csv-table td:last-child {
        border-bottom: none;
    }

    .ectw-csv-table td::before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: #374151;
        display: inline-block;
        margin-right: 4px;
    }

    .ectw-csv-table tr td:first-child {
        font-weight: 700;
    }
}

/* Labels & wrappers */
.ectw-search-wrapper,
.ectw-date-wrapper,
.ectw-status-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ectw-search-label,
.ectw-date-label,
.ectw-status-label {
    font-size: 11px;
    color: #777;
    line-height: 1.2;
}

/* unify heights */
.ectw-table-search,
.ectw-date-filter,
.ectw-status-btn {
    height: 38px;
    box-sizing: border-box;
}

/* Desktop alignment */
@media (min-width: 769px) {
    .ectw-filters {
        flex-wrap: nowrap;
        align-items: flex-end;
    }

    .ectw-search-wrapper {
        flex: 0 0 260px;
    }

    .ectw-date-wrapper {
        flex: 0 0 180px;
    }

    .ectw-status-wrapper {
        flex: 1 1 auto;
    }

    .ectw-status-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .ectw-status-btn {
        flex: 0 0 auto;
    }
}

/* Override Hello Elementor button styling for CSV status filters */

.ectw-status-btn,
.ectw-status-btn:focus,
.ectw-status-btn:active {
    background-color: #ffffff !important;
    border: 1px solid #374151 !important; /* same color family used in theme */
    border-radius: 6px !important;
    color: #c3366f !important;
    font-size: 14px !important;
    padding: 6px 14px !important;
    font-weight: 400 !important;
    text-align: center;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.25s ease;
}

/* Hover state */
.ectw-status-btn:hover {
    background-color: #fde6f0 !important;
    border-color: #374151 !important;
    color: #c2185b !important;
}

/* Active (selected) filter button */
.ectw-status-btn-active {
    background-color: #fff !important;
    border-color: #374151 !important;
    color: #b41450 !important;
    box-shadow: 0 0 0 1px rgba(194, 24, 91, 0.25);
}

.ectw-history-toggle {
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
}

.ectw-history-btn {
    background: #ffffff;
    border: 1px solid #374151;
    color: #374151;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}

.ectw-history-btn-active {
    background: #fde6f0;
    border-color: #c2185b;
    color: #c2185b;
}

.ectw-pagination {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4b5563;
}

.ectw-page-links {
    display: flex;
    gap: 6px;
}

.ectw-page-link {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #374151;
    background: #ffffff;
    text-decoration: none;
    font-size: 13px;
    color: #374151;
    transition: background 0.2s ease, color 0.2s ease;
}

.ectw-page-link:hover {
    background: #fde6f0;
    color: #b41450;
}

/* Mobile: stack info + buttons */
@media (max-width: 768px) {
    .ectw-pagination {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =======================
   Pagination styling
   ======================= */

.ectw-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    padding: 6px 0;
    border-top: 1px solid #e5e7eb;
    font-size: 13px;
}

.ectw-page-info {
    color: #4b5563; /* gray-700 */
}

/* Prev/Next buttons */
.ectw-page-prev,
.ectw-page-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    color: #374151;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ectw-page-prev:hover,
.ectw-page-next:hover {
    background-color: #fde6f0;        /* same family as status filters */
    border-color: #374151;
    box-shadow: 0 0 0 1px rgba(194, 24, 91, 0.15);
}

/* Mobile: stack pagination nicely */
@media (max-width: 768px) {
    .ectw-pagination {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .ectw-page-prev,
    .ectw-page-next {
        width: 100%;
        max-width: 220px;
    }
}
