/**
 * Enhanced Frontend CSS for HPS CSV Importer with Global Search Support
 */

.hps-csv-table-wrapper,
.hps-csv-global-search-wrapper {
    margin: 20px 0;
}

.hps-csv-table-header {
    margin-bottom: 15px;
}

.hps-csv-table-search {
    width: 100%;
    position: relative;
}

.hps-csv-table-search-input,
.hps-csv-global-search-input {
    width: 100%;
    padding: 8px 12px 8px 35px;
   
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    box-sizing: border-box;
}

.hps-csv-table-search-input:focus,
.hps-csv-global-search-input:focus {
    outline: none;
    border-color: #a91b0c;
    box-shadow: 0 0 5px rgba(217, 17, 24, 0.3);
}

.hps-csv-table-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

.hps-csv-table-container {
    overflow-x: auto;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.hps-csv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.hps-csv-table-th {
    background-color: #4a4a4a;
    color: white;
    padding: 10px 15px;
    text-align: left;
    position: relative;
    cursor: pointer;
    user-select: none;
    border-right: 1px solid #5e5e5e;
}

.hps-csv-table-th:last-child {
    border-right: none;
}

.hps-csv-table-th:hover {
    background-color: #3a3a3a;
}

.hps-csv-table-sort-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 5px;
}

.hps-csv-table-th.hps-csv-table-sort-asc .hps-csv-table-sort-icon::after {
    content: '▲';
    font-size: 10px;
    color: white;
}

.hps-csv-table-th.hps-csv-table-sort-desc .hps-csv-table-sort-icon::after {
    content: '▼';
    font-size: 10px;
    color: white;
}

/* Striped table styles */
.hps-csv-table tr {
    background-color: #ffffff;
}

.hps-csv-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.hps-csv-table-td {
    padding: 8px 15px;
    border-bottom: 1px solid #ddd;
    vertical-align: middle;
}

.hps-csv-table tr:hover {
    background-color: #e9ecef;
}

.hps-csv-table-actions {
    text-align: center;
    white-space: nowrap;
}

.hps-csv-table-action {
    display: inline-block;
    padding: 6px 12px;
    background-color: transparent;
    color: #d91118;
    font-weight: bold;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    transition: color 0.2s;
}

.hps-csv-table-action:hover {
    color: #a91b0c;
    text-decoration: underline;
}

/* Global search specific styles */
.hps-csv-global-search-wrapper .hps-csv-table-th {
    background-color: #d91118;
}

.hps-csv-global-search-wrapper .hps-csv-table-th:hover {
    background-color: #a91b0c;
}

.hps-csv-table-source {
    display: inline-block;
    padding: 2px 8px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 11px;
    color: #666;
    font-weight: normal;
}

.hps-csv-table-no-search {
    text-align: center;
    padding: 30px 15px;
    color: #666;
    font-style: italic;
}

/* Skeleton Loading */
.hps-csv-table-skeleton {
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.hps-csv-table-skeleton-row .hps-csv-table-td {
    padding: 12px 15px;
}

.hps-csv-table-skeleton-row:hover .hps-csv-table-td {
    background-color: transparent;
}

/* Footer Styles */
.hps-csv-table-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-top: 15px;
}

.hps-csv-table-info {
    margin-bottom: 10px;
}

.hps-csv-table-pagination {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.hps-csv-table-pagination button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    min-width: 32px;
    height: 32px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin: 0 2px;
    color: #333;
    box-sizing: border-box;
}

.hps-csv-table-pagination button svg {
    width: 16px;
    height: 16px;
}

.hps-csv-table-pagination button:hover:not(:disabled) {
    background-color: #e0e0e0;
}

.hps-csv-table-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hps-csv-table-pagination-numbers {
    display: flex;
    align-items: center;
    margin: 0 4px;
}

.hps-csv-table-pagination-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    margin: 0 2px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    box-sizing: border-box;
}

.hps-csv-table-pagination-number.active {
    background-color: #4a4a4a;
    color: white;
    border-color: #4a4a4a;
    font-weight: bold;
}

/* Global search active pagination number */
.hps-csv-global-search-wrapper .hps-csv-table-pagination-number.active {
    background-color: #d91118;
    border-color: #d91118;
}

.hps-csv-table-pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    margin: 0 2px;
    font-size: 14px;
}

.hps-csv-table-per-page {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.hps-csv-table-per-page-select {
    margin-left: 8px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.hps-csv-table-loading,
.hps-csv-table-error,
.hps-csv-table-no-results {
    text-align: center;
    padding: 30px 15px;
    color: #666;
}

.hps-csv-table-error {
    color: #d91118;
}

.hps-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px 15px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Global search wrapper styling */
.hps-csv-global-search-wrapper {
    border: 2px solid #d91118;
    border-radius: 8px;
    padding: 20px;
    background-color: #fafafa;
}

.hps-csv-global-search-wrapper .hps-csv-table-header {
    margin-bottom: 20px;
}

.hps-csv-global-search-wrapper .hps-csv-table-container {
    border: 2px solid #d91118;
    border-radius: 6px;
}

/* Responsive styles */
@media screen and (max-width: 768px) {
    .hps-csv-table-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .hps-csv-table-search {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .hps-csv-table-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .hps-csv-table-info,
    .hps-csv-table-pagination,
    .hps-csv-table-per-page {
        margin-bottom: 15px;
        width: 100%;
    }
    
    .hps-csv-table-th,
    .hps-csv-table-td {
        padding: 8px 10px;
    }
    
    .hps-csv-table-action {
        padding: 4px 8px;
    }
    
    .hps-csv-table-pagination {
        overflow-x: auto;
        padding-bottom: 5px;
    }
    
    .hps-csv-global-search-wrapper {
        padding: 15px;
        margin: 15px 0;
    }
    
    /* Hide source column on mobile for global search */
    .hps-csv-global-search-wrapper .hps-csv-table-th:nth-child(4),
    .hps-csv-global-search-wrapper .hps-csv-table-td:nth-child(4) {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    .hps-csv-table-search-input,
    .hps-csv-global-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}