/* NKR Data View Widget Styles */

.nkr-data-view-widget {
    width: 100%;
}

/* Filters Container */
.nkr-filters-container {
    display: flex;
    flex-wrap: wrap;
}

.nkr-filter-group {
    display: flex;
    flex-direction: column;
    /*min-width: 200px;*/
    box-sizing: border-box;
    flex-shrink: 0;
}

.nkr-filter-label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
}

.nkr-filter-field {
    width: 100%;
}

.nkr-filter-field input,
.nkr-filter-field select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    transition: border-color 0.3s ease;
}

.nkr-filter-field input:focus,
.nkr-filter-field select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.nkr-clear-filters {
    background: #666;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    align-self: flex-end;
    margin-top: 20px;
}

.nkr-clear-filters:hover {
    background: #555;
}

/* Table Container */
.nkr-table-container {
    width: 100%;
    overflow-x: auto;
}

/* Table Styles */
.nkr-data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
}

.nkr-data-table thead th {
    background: #f0f0f1;
    color: #333;
    font-weight: 600;
    padding: 12px 15px;
    text-align: left;
    border-bottom: 2px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 1;
}

.nkr-data-table tbody td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
    line-height: 1.5;
}

.nkr-data-table tbody tr:hover {
    background: #f9f9f9;
}

.nkr-data-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.nkr-data-table tbody tr:nth-child(even):hover {
    background: #f5f5f5;
}

/* Hidden rows for filtering */
.nkr-table-row.nkr-filtered-out {
    display: none;
}

/* No data message */
.nkr-no-data,
.nkr-no-format {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nkr-filters-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nkr-filter-group {
        min-width: 100%;
        margin-bottom: 10px;
    }
    
    .nkr-clear-filters {
        align-self: stretch;
        margin-top: 10px;
    }
    
    .nkr-table-container {
        font-size: 13px;
    }
    
    .nkr-data-table thead th,
    .nkr-data-table tbody td {
        padding: 8px 10px;
    }
    
    /* Make table horizontally scrollable on mobile */
    .nkr-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nkr-data-table {
        min-width: 600px; /* Ensure table doesn't become too narrow */
    }
}

@media (max-width: 480px) {
    .nkr-filters-container {
        padding: 15px;
    }
    
    .nkr-filter-field input,
    .nkr-filter-field select {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px 12px;
    }
    
    .nkr-data-table {
        min-width: 500px;
        font-size: 12px;
    }
    
    .nkr-data-table thead th,
    .nkr-data-table tbody td {
        padding: 6px 8px;
    }
}

/* RTL Support */
[dir="rtl"] .nkr-data-table thead th,
[dir="rtl"] .nkr-data-table tbody td {
    text-align: right;
}

[dir="rtl"] .nkr-filters-container {
    direction: rtl;
}

/* Loading State */
.nkr-data-view-widget.nkr-loading {
    opacity: 0.6;
    pointer-events: none;
}

.nkr-data-view-widget.nkr-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: nkr-spin 1s linear infinite;
}

@keyframes nkr-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Filter Status Indicator */
.nkr-filter-active {
    position: relative;
}

.nkr-filter-active::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #007cba;
    border-radius: 50%;
    border: 2px solid white;
}

/* Responsive Filter Width Support */
.nkr-filter-group {
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Ensure filters don't overflow container */
.nkr-filters-container {
    overflow: hidden;
}

/* Default mobile behavior - stack filters on very small screens */
@media (max-width: 480px) {
    .nkr-filters-container {
        flex-direction: column;
    }
    
    .nkr-filter-group {
        width: 100% !important;
        min-width: auto;
    }
}
