/* =============================================================
   ICR Plugin Frontend — bridges plugin classes to site stylesheet
   Uses the same CSS variables and class patterns as the homepage
   ============================================================= */

/* ------------------------------------------------------------------
   Search bar wrapper — maps .icr-filter-bar to .icr-search-bar style
   ------------------------------------------------------------------ */
.icr-search-wrap .icr-filter-bar {
    background: var(--theme-palette-color-4);
    border-radius: 2px 2px 0 0;
    padding: 14px 16px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 3px solid var(--theme-palette-color-1);
    margin-bottom: 0;
}

/* All filter fields inline — no column stacking */
.icr-search-wrap .icr-filter-row {
    display: contents; /* children go directly into the flex parent */
}

.icr-search-wrap .icr-filter-field {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    min-width: 150px;
}

.icr-search-wrap .icr-filter-field--sm {
    flex: 0 0 120px;
    min-width: 100px;
}

/* Hide labels — placeholders handle all context */
.icr-search-wrap .icr-filter-field label {
    display: none;
}

/* Inputs & selects — match .icr-search-bar inputs exactly */
.icr-search-wrap .icr-filter-field input[type="text"],
.icr-search-wrap .icr-filter-field select {
    padding: 8px 11px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 2px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    height: 34px;
    width: 100%;
    box-sizing: border-box;
}

.icr-search-wrap .icr-filter-field input[type="text"]::placeholder {
    color: rgba(255,255,255,0.38);
}

.icr-search-wrap .icr-filter-field input[type="text"]:focus,
.icr-search-wrap .icr-filter-field select:focus {
    border-color: var(--theme-palette-color-1);
    background: rgba(255,255,255,0.13);
    outline: none;
}

.icr-search-wrap .icr-filter-field select option {
    background: var(--theme-palette-color-4);
    color: #fff;
}

/* ------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------ */
.icr-search-wrap .icr-filter-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.icr-search-wrap .icr-btn--search {
    background: var(--theme-palette-color-1);
    color: var(--theme-palette-color-4);
    border: none;
    padding: 0 20px;
    height: 34px;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.icr-search-wrap .icr-btn--search:hover {
    background: var(--theme-palette-color-2);
}

.icr-search-wrap .icr-btn--reset {
    background: transparent;
    color: rgba(255,255,255,0.45);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0 14px;
    height: 34px;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 2px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.icr-search-wrap .icr-btn--reset:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}

/* ------------------------------------------------------------------
   Results meta bar
   ------------------------------------------------------------------ */
/* Hidden by default — shown via jQuery after search */
.icr-search-wrap .icr-results-info {
    display: none;
    background: #f0ece3;
    border: 1px solid var(--theme-palette-color-5);
    border-top: none;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #888;
}

.icr-search-wrap .icr-results-info strong {
    color: var(--theme-palette-color-4);
    font-weight: 700;
}

/* ------------------------------------------------------------------
   Table wrapper
   ------------------------------------------------------------------ */
.icr-search-wrap .icr-table-wrap {
    border: 1px solid var(--theme-palette-color-5);
    border-top: none;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(26,39,68,0.07);
}

/* ------------------------------------------------------------------
   Table
   ------------------------------------------------------------------ */
.icr-search-wrap .icr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.icr-search-wrap .icr-table thead tr {
    background: #eae6dc;
}

.icr-search-wrap .icr-table thead th {
    padding: 10px 13px;
    text-align: left;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--theme-palette-color-4);
    border-bottom: 2px solid var(--theme-palette-color-5);
    white-space: nowrap;
    user-select: none;
}

.icr-search-wrap .icr-table tbody tr {
    background: #fff;
    transition: background 0.15s;
}

.icr-search-wrap .icr-table tbody tr:nth-child(even) {
    background: #fdfcf8;
}

.icr-search-wrap .icr-table tbody tr:hover {
    background: #fdf8ee;
}

.icr-search-wrap .icr-table tbody td {
    padding: 10px 13px;
    border-bottom: 1px solid #f0ece3;
    color: #3a3a3a;
    vertical-align: middle;
    line-height: 1.4;
}

.icr-search-wrap .icr-table tbody tr:last-child td {
    border-bottom: none;
}

/* ------------------------------------------------------------------
   Status badges — match site's .icr-badge style
   ------------------------------------------------------------------ */
.icr-search-wrap .icr-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.icr-search-wrap .icr-status-filed {
    background: #e8eef7;
    color: var(--theme-palette-color-4);
}

.icr-search-wrap .icr-status-dismissed {
    background: #fee2e2;
    color: #991b1b;
}

.icr-search-wrap .icr-status-discharged {
    background: #d1fae5;
    color: #065f46;
}

.icr-search-wrap .icr-status-closed {
    background: #f3f4f6;
    color: #4b5563;
}

/* ------------------------------------------------------------------
   No results
   ------------------------------------------------------------------ */
.icr-search-wrap .icr-no-results {
    text-align: center;
    color: #999;
    padding: 50px 20px !important;
    font-style: italic;
    font-size: 14px;
}

/* ------------------------------------------------------------------
   Table footer + pagination — matches .icr-table-footer style
   ------------------------------------------------------------------ */
/* Hidden by default — shown via jQuery after search */
.icr-search-wrap .icr-pagination {
    display: none;
    background: #f0ece3;
    border: 1px solid var(--theme-palette-color-5);
    border-top: 1px solid var(--theme-palette-color-5);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #aaa;
    flex-wrap: wrap;
    gap: 8px;
    border-radius: 0 0 2px 2px;
}

.icr-search-wrap .icr-pagination-btns {
    display: flex;
    gap: 4px;
    align-items: center;
}

.icr-search-wrap .icr-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: 2px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--theme-palette-color-5);
    background: #fff;
    color: var(--theme-palette-color-4);
    cursor: pointer;
    transition: background 0.15s;
    font-family: 'Source Sans 3', sans-serif;
}

.icr-search-wrap .icr-page-btn.active {
    background: var(--theme-palette-color-4);
    color: #fff;
    border-color: var(--theme-palette-color-4);
}

.icr-search-wrap .icr-page-btn:hover:not(.active):not(:disabled) {
    background: #f7f4ee;
    border-color: var(--theme-palette-color-1);
}

.icr-search-wrap .icr-page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.icr-search-wrap .icr-page-info {
    font-size: 12px;
    color: #aaa;
}

/* ------------------------------------------------------------------
   Loading
   ------------------------------------------------------------------ */
/* Hidden by default — shown via jQuery .show() only while searching */
.icr-search-wrap .icr-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    color: #888;
    font-size: 13px;
    background: #fff;
    border: 1px solid var(--theme-palette-color-5);
    border-top: none;
}

.icr-search-wrap .icr-page-btn.icr-page-prev,
.icr-search-wrap .icr-page-btn.icr-page-next {
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
}

.icr-search-wrap .icr-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 28px;
    color: #bbb;
    font-size: 13px;
    letter-spacing: 0;
}

.icr-search-wrap .icr-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e2e0d8;
    border-top-color: var(--theme-palette-color-1);
    border-radius: 50%;
    animation: icr-spin 0.7s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}

@keyframes icr-spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */
@media (max-width: 700px) {
    .icr-search-wrap .icr-filter-bar { flex-direction: column; align-items: stretch; }
    .icr-search-wrap .icr-filter-field { flex: 0 0 100%; min-width: 0; }
    .icr-search-wrap .icr-filter-field--sm { flex: 0 0 calc(50% - 4px); }
    .icr-search-wrap .icr-filter-actions { justify-content: flex-start; }
    .icr-search-wrap .icr-table { font-size: 12px; }
    .icr-search-wrap .icr-table thead th,
    .icr-search-wrap .icr-table tbody td { padding: 8px 9px; }
}

/* ── Download Button (matches Reset style — sits alongside Search/Reset) */
.icr-search-wrap .icr-btn--download {
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0 16px;
    height: 34px;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 2px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.icr-search-wrap .icr-btn--download:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.06);
}

/* ── Global Search Database Badges ──────────────────────────── */
.icr-badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: #fff; white-space: nowrap; }
.icr-badge-bankruptcy  { background: #6a4c93; }
.icr-badge-court       { background: #1a6ea8; }
.icr-badge-liens       { background: #1a7a4a; }
.icr-badge-fedtax      { background: #c44d1a; }
