/* ═══════════════════════════════════════════════════════════
   Common Pagination & Table Styles
   Include this CSS on every page that uses CommonPagination or CommonTable
   ═══════════════════════════════════════════════════════════ */

/* ─── Pagination ───────────────────────────────────────────── */
.cp-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 0;
    font-size: 13px;
    color: #555;
}

.cp-info {
    font-size: 13px;
    color: #666;
}

.cp-per-page {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.cp-per-page select {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
}

.cp-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    padding: 8px 0;
}

.cp-btn {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.cp-btn:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
}

.cp-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.cp-btn.cp-active {
    background: #13294B;
    color: #fff;
    border-color: #13294B;
    font-weight: 700;
}

.cp-arrow {
    padding: 6px 14px;
    font-weight: 600;
}

.cp-ellipsis {
    padding: 6px 4px;
    color: #999;
}

.cp-page-input {
    width: 50px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    text-align: center;
}

.cp-page-input:focus {
    outline: none;
    border-color: #13294B;
    box-shadow: 0 0 0 2px rgba(19,41,75,0.15);
}

.cp-goto {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
    margin-left: 8px;
}

.cp-goto input {
    width: 50px;
}

/* ─── Table auto-size styles ───────────────────────────────── */
.cp-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.cp-table th,
.cp-table td {
    padding: 8px 12px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-table th {
    position: relative;
    user-select: none;
}

/* Sort indicators */
.cp-table th.cp-sorted-asc::after {
    content: ' ▲';
    font-size: 10px;
    opacity: 0.7;
}

.cp-table th.cp-sorted-desc::after {
    content: ' ▼';
    font-size: 10px;
    opacity: 0.7;
}

.cp-table th:not(.cp-sorted-asc):not(.cp-sorted-desc):not([data-no-sort])::after {
    content: ' ⇅';
    font-size: 9px;
    opacity: 0.3;
}

/* Column resizer handle */
.cp-resizer {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: transparent;
    cursor: col-resize;
    user-select: none;
    touch-action: none;
    z-index: 1;
}

.cp-resizer:hover,
.cp-resizer:active {
    background: rgba(19, 41, 75, 0.3);
}

/* ─── Terminal modal shared styles ─────────────────────────── */
.cp-terminal-modal .modal-overlay,
.cp-terminal-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.cp-terminal-modal.active {
    display: flex;
}

.cp-terminal-content {
    background: white;
    border-radius: 12px;
    width: 1000px;
    max-width: 97vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.cp-terminal-header {
    padding: 14px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.cp-terminal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #13294B;
}

.cp-terminal-output {
    flex: 1;
    background: #0d1117;
    color: #c9d1d9;
    padding: 14px 16px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 12.5px;
    overflow-y: auto;
    white-space: pre;
    word-break: break-all;
    min-height: 300px;
    max-height: calc(90vh - 100px);
    line-height: 1.55;
    border-radius: 0 0 12px 12px;
}

.cp-terminal-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

.cp-terminal-status {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.cp-terminal-btn {
    background: rgba(19,41,75,0.15);
    border: none;
    color: #13294B;
    padding: 4px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

.cp-terminal-btn:hover {
    background: rgba(19,41,75,0.25);
}
