/* Spinner and overlay styles */
#cwpai-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cwpai-spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: cwpai-spin 1s linear infinite;
}

@keyframes cwpai-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

#cwpai-attendees {
    font-size: 12px;
}

#cwpai-attendees button {
    font-size: 12px;
    padding: 3px 6px;
}

/* Filter panel - fixed width, no scroll */
.cwpai-filter-panel {
    width: 100%;
    background: #fff;
    padding: 10px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.cwpai-filters {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    gap: 8px;
}

.cwpai-filters input[type="text"] {
    width: 300px;
    max-width: 100%;
}

.cwpai-filters select {
    width: 300px;
    max-width: 100%;
}

/* Filter buttons row */
.cwpai-filters>div {
    display: flex;
    gap: 5px;
    width: 300px;
    max-width: 100%;
}

.cwpai-filters button {
    flex: 1;
}

/* Add attendee button styling */
.cwpai-add-btn {
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 10px;
}

/* Table container - scrollable */
.cwpai-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 250px);
}

/* Ensure same height for select and buttons as text inputs */
.cwpai-filters input[type="text"],
.cwpai-filters select,
.cwpai-filters button {
    height: 28px;
    /* approximate height to match padding/text */
    box-sizing: border-box;
}

/* Vertically center button text */
.cwpai-filters button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    /* let flex handle centering */
    padding: 0 10px;
    /* horizontal padding, height controlled above */
}

/* Align select content vertically */
.cwpai-filters select {
    line-height: 28px;
}

/* Table header styling */
#cwpai-table thead th {
    padding: 4px;
    background-color: #f2f2f2;
    /* light grey */
    white-space: nowrap;
    /* prevent header label wrapping */
}

/* Table data cell padding */
#cwpai-table tbody td {
    padding: 4px;
}

/* Zebra striping for data rows: every 2nd row */
#cwpai-table tbody tr:nth-child(even) {
    background-color: #fff9cc;
    /* light yellow */
}

/* Sortable headers styling */
#cwpai-table thead th.cwpai-sortable {
    cursor: pointer;
}

#cwpai-table thead th .cwpai-sort {
    margin-left: 6px;
    font-size: 10px;
}

#cwpai-table thead th .cwpai-tri-up,
#cwpai-table thead th .cwpai-tri-down {
    color: #aaa;
    /* inactive */
}

/* Modal styles */
#cwpai-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    /* toggled via JS */
    z-index: 1000;
}

#cwpai-modal {
    background: #fff;
    max-width: 720px;
    width: 90%;
    margin: 40px auto;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    /* modal may be longer than visible window */
}

.cwpai-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

#cwpai-modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

.cwpai-modal-body {
    padding: 12px 16px;
}

.cwpai-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid #eee;
}

.cwpai-modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.cwpai-modal-error {
    color: #d63301;
    font-size: 13px;
    margin-bottom: 8px;
    min-height: 18px;
}

.cwpai-field {
    margin-bottom: 10px;
}

.cwpai-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

.cwpai-field input,
.cwpai-field select,
.cwpai-field textarea {
    width: 100%;
    box-sizing: border-box;
}

.cwpai-field input.cwpai-error,
.cwpai-field select.cwpai-error,
.cwpai-field textarea.cwpai-error {
    border-color: #d63301;
    border-width: 2px;
}

.cwpai-field-error {
    display: block;
    color: #d63301;
    font-size: 12px;
    margin-top: 2px;
    min-height: 16px;
}

#cwpai-confirm {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: #fff7e6;
    border: 1px solid #ffd591;
    padding: 10px 12px;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    display: none;
    /* toggled via JS */
}

.cwpai-confirm-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
}

/* Min-width for specific columns (Comment = 18th, Education = 19th) */
#cwpai-table thead th:nth-child(18),
#cwpai-table tbody td:nth-child(18) {
    min-width: 220px;
}

#cwpai-table thead th:nth-child(19),
#cwpai-table tbody td:nth-child(19) {
    min-width: 180px;
}

/* Action column (last column) - prevent wrapping for buttons */
#cwpai-table thead th:last-child,
#cwpai-table tbody td:last-child {
    white-space: nowrap;
    min-width: 150px;
}