/* Resource Filters REST API Styling - Upstream Kansas Theme v3.3 */

.upstream-resource-finder {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    max-width: 100%;
    margin: 0;
    line-height: 1.6;
}

/* Filters Container - matches your current site styling */
.rrf-filters-container {
    background: rgba(255, 255, 255, 0.6);
    padding: 20px;
    border-radius: 0.5em;
    margin-bottom: 20px;
    padding-bottom: 30px;
}

.rrf-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.rrf-filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
    flex: 1;
}

.rrf-search-group {
    min-width: 200px;
    flex: 1.2;
}

.rrf-filter-group label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rrf-select,
.rrf-search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.rrf-select:focus,
.rrf-search-input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.1);
}

.rrf-search-input {
    background: white url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23999" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') no-repeat 95% center;
    padding-right: 35px;
}

.rrf-clear-btn {
    padding: 8px 16px;
    background: white;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rrf-clear-btn:hover {
    background: #f8f9fa;
    border-color: #bbb;
    color: #333;
}

/* Loading State */
.rrf-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.rrf-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4299e1;
    border-radius: 50%;
    animation: rrf-spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Table Container - with horizontal scroll for mobile */
.rrf-table-container {
    background: white;
    border-radius: 1em;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
}

.rrf-table {
    width: 100%;
    min-width: 800px; /* Ensures table doesn't compress too much */
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.4;
    border-radius: 1em;
}

/* Table Header - your beautiful yellow theme! */
.rrf-table thead {
    background-color: rgb(244, 210, 95);
    color: black;
    position: sticky;
    top: 0;
    z-index: 10;
}

.rrf-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
}

/* Sortable columns */
.rrf-sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.rrf-sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.rrf-sort-icon {
    float: right;
    margin-left: 8px;
    margin-top: 1px;
    opacity: 0.7;
    transition: all 0.2s ease;
    color: #333; /* Dark color for better contrast on yellow */
}

.rrf-sorted .rrf-sort-icon {
    opacity: 1;
    color: #000; /* Even darker when active */
}

/* Table Body */
.rrf-table tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.rrf-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.rrf-table tbody tr:hover {
    background: #f0f8ff;
}

.rrf-table td {
    padding: 12px;
    vertical-align: top;
    border-right: 1px solid #f0f0f0;
}

.rrf-table td:last-child {
    border-right: none;
}

/* Column specific styling */
.rrf-org-name {
    font-weight: 600;
    color: #1a202c;
    min-width: 200px;
    max-width: 250px;
}

.rrf-group-type {
    min-width: 120px;
    max-width: 150px;
}

.rrf-county {
    min-width: 100px;
    max-width: 120px;
}

.rrf-cities {
    min-width: 150px;
    max-width: 200px;
    word-wrap: break-word;
}

.rrf-contact {
    min-width: 180px;
    max-width: 220px;
    word-wrap: break-word;
}

.rrf-email-link {
    color: #4299e1;
    text-decoration: none;
    font-weight: 500;
    word-break: break-all;
}

.rrf-email-link:hover {
    color: #3182ce;
    text-decoration: underline;
}

.rrf-no-contact {
    color: #a0aec0;
    font-style: italic;
    font-size: 12px;
}

/* Results Count */
.rrf-results-count {
    text-align: right;
    color: var(--e-global-color-text);
    font-size: 14px;
    padding: 10px 0;
    margin-bottom: 15px;
}

/* No Results State */
.rrf-no-results {
    text-align: center;
    padding: 60px 30px;
    background: white;
    border: 1px solid #e0e0e0;
}

.rrf-no-results h3 {
    color: #4a5568;
    font-size: 20px;
    margin-bottom: 10px;
    font-weight: 600;
}

.rrf-no-results p {
    color: #718096;
    font-size: 14px;
    margin: 0;
}

/* Error State */
.rrf-error {
    background: #fed7d7;
    color: #742a2a;
    padding: 15px;
    border-radius: 4px;
    border-left: 4px solid #e53e3e;
    text-align: center;
    margin: 15px 0;
}

/* Responsive Design */
@media (max-width: 968px) {
    .rrf-filters-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .rrf-filter-group,
    .rrf-search-group {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .upstream-resource-finder {
        margin: 0 -15px;
    }
    
    .rrf-filters-container {
        padding: 15px;
        margin: 0 15px 15px;
        border-radius: 4px;
        border: 1px solid #e0e0e0;
    }
    
    .rrf-table-container {
        margin: 0 15px 15px;
        border-radius: 4px;
        /* Ensure horizontal scroll on mobile */
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .rrf-table {
        min-width: 700px; /* Force horizontal scroll */
        font-size: 12px;
    }
    
    .rrf-table th,
    .rrf-table td {
        padding: 8px 6px;
    }
    
    .rrf-results-count {
        margin: 0 15px 15px;
        padding: 8px 0;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .rrf-table {
        min-width: 600px; /* Still force scroll, but smaller */
        font-size: 11px;
    }
    
    .rrf-table th,
    .rrf-table td {
        padding: 6px 4px;
    }
    
    .rrf-org-name {
        min-width: 120px;
        max-width: 150px;
    }
    
    .rrf-group-type {
        min-width: 80px;
        max-width: 100px;
    }
    
    .rrf-county {
        min-width: 70px;
        max-width: 90px;
    }
    
    .rrf-cities {
        min-width: 100px;
        max-width: 130px;
    }
    
    .rrf-contact {
        min-width: 120px;
        max-width: 150px;
    }
}

/* Focus accessibility */
.rrf-select:focus,
.rrf-search-input:focus,
.rrf-clear-btn:focus,
.rrf-sortable:focus {
    outline: 2px solid #4299e1;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(66, 153, 225, 0.2);
}
