/* ==========================================================================
   CSV Upload & Display Widget — Styles
   Scoped to the cctbfe-container and its children.
   ========================================================================== */

/* ── Container ──────────────────────────────────────────────── */

.cctbfe-container {
    margin: 20px 0;
    font-family: inherit;
}

/* ── Heading & Description ──────────────────────────────────── */

.cctbfe-table-heading {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 15px 0;
    color: #333333;
}

.cctbfe-table-description {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 15px 0;
    color: #666666;
}

/* ── Search ─────────────────────────────────────────────────── */

.cctbfe-search-wrapper {
    margin-bottom: 20px;
}

.cctbfe-search-input-wrapper {
    position: relative;
    width: 100%;
}

.cctbfe-search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.cctbfe-search-input:focus {
    outline: none;
    border-color: #999;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.cctbfe-search-icon,
.cctbfe-clear-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.cctbfe-clear-icon {
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s ease;
}

.cctbfe-clear-icon:hover {
    opacity: 0.7;
}

/* ── Table (two-layer scroll structure) ─────────── */
/*
 * .cctbfe-table-scroll-track  outer shell — border, border-radius,
 *                               overflow:clip (visual only, no scroll block).
 * .cctbfe-table-wrapper        inner shell — overflow-x:auto for scroll.
 *                               Never receives overflow:hidden.
 */

.cctbfe-table-scroll-track {
    width: 100%;
}

.cctbfe-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cctbfe-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    border-spacing: 0;
    margin: 0;
}

.cctbfe-table thead th {
    background-color: #6040e0;
    color: #ffffff;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
}

.cctbfe-table tbody td {
    padding: 10px 15px;
    color: #333333;
    border-bottom: 1px solid #eee;
}

.cctbfe-table tbody tr:hover td {
    background-color: #f0f0f0;
}

/* ── List view ──────────────────────────────────────────────── */

.cctbfe-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cctbfe-list .cctbfe-row {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

/* ── Pagination ─────────────────────────────────────────────── */

.cctbfe-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 20px;
    justify-content: center;
}

.cctbfe-pagination button {
    cursor: pointer;
    padding: 8px 15px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.cctbfe-pagination button:hover {
    background: #e0e0e0;
}

.cctbfe-pagination button.active {
    background: #6040e0;
    color: #fff;
    border-color: #6040e0;
}

.cctbfe-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cctbfe-pagination-ellipsis {
    padding: 8px 4px;
    display: inline-flex;
    align-items: center;
}

/* ── Mobile – horizontal scroll (default) ───────────────────── */

.cctbfe-mobile-scroll .cctbfe-table-scroll-track {
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* ── Mobile – stacked cards ─────────────────────────────────── */

@media screen and (max-width: 768px) {
    .cctbfe-mobile-cards .cctbfe-table-wrapper {
        overflow-x: visible;
    }

    .cctbfe-mobile-cards .cctbfe-table {
        min-width: 100%;
    }

    .cctbfe-mobile-cards .cctbfe-table thead {
        display: none;
    }

    .cctbfe-mobile-cards .cctbfe-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 15px;
        background: #fff;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .cctbfe-mobile-cards .cctbfe-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        text-align: right;
    }

    .cctbfe-mobile-cards .cctbfe-table tbody td:last-child {
        border-bottom: none;
    }

    .cctbfe-mobile-cards .cctbfe-table tbody td::before {
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        flex: 0 0 40%;
        padding-right: 10px;
    }
}

/* ── Cell images ────────────────────────────────────────────── */

.cctbfe-cell-image {
    max-width: 100px;
    height: auto;
    display: inline-block;
    vertical-align: middle;
}

.cctbfe-list-image {
    margin-right: 10px;
}
