/* Vendor Data Visualizer Styles */

.vdv-container {
    position: relative;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.vdv-filters {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.vdv-filter-row {
    display: flex;
    gap: 20px;
    margin-bottom: 0;
}

.vdv-filter-cell {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.vdv-filter-group {
    flex: 1;
    min-width: 0;
}

.vdv-filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #495057;
    font-size: 14px;
}

.vdv-filter-group select,
.vdv-filter-group input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    min-height: 40px;
}

.vdv-filter-group input[type="text"] {
    box-sizing: border-box;
}

.vdv-clear-btn {
    background-color: #6d1afe;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    min-height: 40px;
    transition: background-color 0.2s ease;
}

.vdv-clear-btn:hover {
    background-color: #c82333;
}

.vdv-clear-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

.vdv-filter-group:has(.vdv-clear-btn) {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

/* Hide DataTables built-in search filter */
#vendor-data-table_filter {
    display: none !important;
}

.vdv-filter-group select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.25);
}

.vdv-table-container {
    background: white;
    overflow: hidden;
}

/* DataTables customization */

.dataTables_filter {
    margin-bottom: 20px;
}

.dataTables_filter input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.dataTables_length {
    margin-bottom: 20px;
}

.dataTables_length select {
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    margin: 0 5px;
}

table.dataTable {
    border-collapse: collapse;
    border: 0;
    width: 100%;
}

table.dataTable thead th {
    background-color: #d9edf7;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: #111;
    font-size: 14px;
    border: 0;
}

table.dataTable tbody td {
    padding: 10px 8px;
    border: 0;
    font-size: 13px;
    vertical-align: top;
}

table.dataTable tbody tr:hover {
    background-color: #f8f9fa;
}

/* Loading state */
.vdv-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #6c757d;
    z-index: 1000;
}

.vdv-loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error state */
.vdv-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
}

/* Responsive design */
@media (max-width: 639px) {
    .vdv-filter-row {
        flex-direction: column;
        gap: 15px;
    }

    .vdv-filter-cell {
        flex-direction: column;
        gap: 10px;
    }

    .vdv-filter-group {
        min-width: 100%;
    }

    table.dataTable {
        font-size: 12px;
    }

    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 8px 4px;
    }
}

@media (min-width: 640px) and (max-width: 1023px) {
    .vdv-filter-row {
        flex-wrap: wrap;
        gap: 15px;
    }

    .vdv-filter-cell {
        flex: 0 0 calc(50% - 7.5px);
        min-width: 0;
    }

    table.dataTable {
        font-size: 13px;
    }

    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 8px 6px;
    }
}

@media (min-width: 1024px) {
    .vdv-filter-row {
        flex-wrap: nowrap;
        gap: 20px;
    }

    .vdv-filter-cell {
        flex: 1;
        min-width: 0;
    }

    table.dataTable {
        font-size: 14px;
    }

    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 10px 8px;
    }
}

/* Single select styling */
.vdv-filter-group select {
    min-height: 40px;
    max-height: 40px;
}

.vdv-filter-group select option {
    padding: 8px 12px;
}

.vdv-filter-group select option:checked {
    background-color: #007cba;
    color: white;
}

/* Export buttons */
.dt-buttons {
    margin-bottom: 20px;
}

.dt-buttons .btn-export {
    background-color: #007cba;
    color: white;
    border: 1px solid #007cba;
    padding: 8px 16px;
    margin-right: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.dt-buttons .btn-export:hover {
    background-color: #005a87;
    border-color: #005a87;
    color: white;
    text-decoration: none;
}

.btn-clear-filters {
    background-color: #6c757d !important;
    color: white !important;
    border: 1px solid #6c757d !important;
    padding: 8px 16px;
    margin-right: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.btn-clear-filters:hover {
    background-color: #545b62 !important;
    border-color: #545b62 !important;
    color: white !important;
    text-decoration: none;
}

/* DataTables info and pagination */
.dataTables_info {
    color: #6c757d;
    font-size: 13px;
    margin-top: 10px;
}

.dataTables_paginate {
    margin-top: 10px;
}

.dataTables_paginate .paginate_button {
    padding: 6px 12px;
    margin: 0 2px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    color: #007cba;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.dataTables_paginate .paginate_button:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.dataTables_paginate .paginate_button.current {
    background-color: #007cba;
    color: white;
    border-color: #007cba;
}

.dataTables_paginate .paginate_button.disabled {
    color: #6c757d;
    cursor: not-allowed;
    background-color: #f8f9fa;
}
