/**
 * Top Firms Template CSS
 * Maps EXACTLY to Review-Driven Legal Comparison UI screenshot.
 */

/* Variables now in design-tokens.css — keep --rs-black for local use */
:root {
    --rs-black: #000000;
}

body.top-firms-template {
    background-color: #ffffff;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--rs-text);
    margin: 0;
    padding: 0;
}

/* NOTE: Old custom header CSS (.rs-custom-header) removed — site now uses rs-global-header */

/* Container */
#top-template-wrapper {
    background-color: #ffffff;
}

#top-template-wrapper .top-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Search Bar Section */
.top-search-section {
    padding: 24px 0;
    border-bottom: 1px solid var(--rs-border);
}

.search-input-group-distinct {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 54px;
}

.btn-category-dropdown {
    background: #fff;
    border: 1px solid var(--rs-border);
    border-radius: 8px;
    height: 100%;
    padding: 0 20px;
    font-weight: 600;
    color: var(--rs-black);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    white-space: nowrap;
    min-width: 200px;
}

.btn-category-dropdown i.fa-bars {
    color: var(--rs-green);
}

.btn-category-dropdown .down-arr {
    margin-left: auto;
    color: var(--rs-text-light);
    font-size: 12px;
}

/* Category Dropdown Menu */
.category-dropdown-wrapper {
    position: relative;
    height: 100%;
}

.category-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #fff;
    border: 1px solid var(--rs-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 250px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
}

.category-dropdown-menu.open {
    display: block;
}

.category-item {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    color: var(--rs-text);
    border-bottom: 1px solid #f3f4f6;
}

.category-item:last-child {
    border-bottom: none;
}

.category-item:hover {
    background: #f9fafb;
    color: var(--rs-green);
}

.category-item.disabled {
    color: var(--rs-text-light);
    cursor: default;
}

.search-input-wrap {
    flex: 1.5;
    height: 100%;
    position: relative;
    border: 1px solid var(--rs-border);
    border-radius: 8px;
}

.search-input-wrap.location-wrap {
    flex: 1;
    position: relative;
}

/* Location Autocomplete */
.location-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--rs-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 380px;
    overflow-y: auto;
    z-index: 200;
}

.location-suggestions.open {
    display: block;
}

/* Practice Area Autocomplete */
.practice-area-wrap {
    position: relative;
}

.practice-area-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--rs-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 380px;
    overflow-y: auto;
    z-index: 200;
}

.practice-area-suggestions.open {
    display: block;
}

.suggestion-item {
    padding: 14px 20px;
    font-size: 15px;
    color: var(--rs-text);
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f9fafb;
    border-left-color: var(--rs-green);
}

.suggestion-parent {
    font-weight: 700;
    color: var(--rs-black);
}

.search-input-wrap input {
    width: 100%;
    height: 100%;
    border: none;
    padding: 0 20px;
    font-size: 15px;
    outline: none;
    background: transparent;
    border-radius: 8px;
}

.location-icon-badge {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #ef4444;
    color: white;
    width: 24px;
    height: 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.btn-search-black {
    background: var(--rs-black);
    color: white;
    border: none;
    height: 100%;
    padding: 0 32px;
    font-weight: 600;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Results Header */
.results-meta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px 0 24px 0;
}

.results-count {
    font-size: 20px;
    font-weight: 500;
    margin: 0;
    color: var(--rs-text);
}

.results-count strong {
    font-weight: 800;
    color: var(--rs-black);
}

.results-sort {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
}

.sort-dropdown {
    padding: 8px 36px 8px 16px;
    border: 1px solid var(--rs-border);
    border-radius: 8px;
    background: #fff;
    font-weight: 500;
    font-size: 14px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
}

/* Grid Layout */
.top-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    padding-bottom: 80px;
}

/* Sidebar */
.top-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.btn-compare-top {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--rs-black);
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    color: var(--rs-black);
    cursor: pointer;
}

/* Sidebar Filters Box */
.sidebar-filters-container {
    border: 1px solid var(--rs-border);
    border-radius: 8px;
    padding: 24px 20px;
    background: #fff;
}

.filter-group {
    margin-bottom: 0;
}

.filter-group + .filter-group {
    border-top: 1px solid #f3f4f6;
    margin-top: 24px;
    padding-top: 24px;
}

.filter-title {
    font-size: 16px;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--rs-black);
}

/* Search Name Input */
.search-name-input {
    display: flex;
    align-items: center;
    border: 1px solid var(--rs-border);
    border-radius: 6px;
    overflow: hidden;
}

.search-icon-left {
    padding-left: 14px;
    margin-right: 8px;
    flex-shrink: 0;
}

.search-name-input input {
    flex: 1;
    border: none;
    padding: 12px 10px 12px 0;
    font-size: 15px;
    color: var(--rs-text);
    outline: none;
    width: 100%;
}

.search-name-input input::placeholder {
    color: var(--rs-text-light);
}

.btn-search-name-submit {
    background: var(--rs-black);
    color: white;
    border: none;
    width: 46px;
    height: 46px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Radio Filters */
.radio-filters {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.radio-label {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    cursor: pointer;
    position: relative;
}

.radio-label input[type="radio"],
.radio-label input[type="checkbox"] {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.radio-custom {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px;
    min-height: 24px;
    border: 2px solid #d1d5db !important;
    border-radius: 50% !important;
    display: inline-block !important;
    position: relative;
    flex-shrink: 0;
    transition: all .15s ease;
    background: #fff !important;
    box-shadow: none !important;
}

.radio-label:hover .radio-custom {
    border-color: var(--rs-green) !important;
}

.radio-label input:checked ~ .radio-custom {
    background: var(--rs-green) !important;
    border-color: var(--rs-green) !important;
}

.radio-label input:checked ~ .radio-custom::after {
    content: '' !important;
    position: absolute;
    top: 50%; left: 50%;
    width: 10px; height: 6px;
    border: 2.5px solid #fff;
    border-top: none; border-right: none;
    transform: translate(-50%, -65%) rotate(-45deg);
}

.star-rating-block {
    display: flex !important;
    align-items: center !important;
    gap: 3px;
    padding: 3px 5px;
    border-radius: 4px;
    flex: 1;
}

.star-rating-block svg {
    width: 16px !important;
    height: 16px !important;
    fill: white;
}

.star-4-5 {
    background: #0b9f52;
}

.star-4-0 {
    background: #84cc16;
}

.star-3-5 {
    background: #eab308;
}

.filter-text {
    font-size: 16px;

    color: var(--rs-black);
    font-weight: 500;
}

/* Recommended Banner */
.recommended-black-banner {
    background: var(--rs-black);
    color: white;
    border-radius: 8px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.banner-label {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.banner-desc {
    font-size: 15px;
    font-weight: 500;
}

.banner-arrow-circle {
    background: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Firm Cards */
.top-firm-card {
    border: 1px solid var(--rs-green-light);
    border-radius: 8px;
    background: white;
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.card-logo-container {
    position: relative;
    flex-shrink: 0;
}

.card-rank-badge {
    position: absolute;
    top: -12px;
    left: -12px;
    width: 28px;
    height: 28px;
    background: var(--rs-green);
    color: white;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 2;
}

.card-logo-box {
    width: 130px;
    height: 130px;
    border: 1px solid var(--rs-border);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.card-logo-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.firm-logo-text {
    font-weight: 700;
    text-align: center;
    color: var(--rs-text);
}

.card-info {
    flex: 1;
    min-width: 0;
}

.card-firm-name {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px 0;
}

.card-firm-name a {
    color: var(--rs-black);
    text-decoration: none;
}

.card-rating-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.stars-badge-greenbg {
    background: var(--rs-green);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    gap: 2px;
}

.rating-num {
    font-weight: 700;
    font-size: 16px;
    color: var(--rs-text);
}

.divider {
    color: #d1d5db;
}

.review-count {
    color: var(--rs-text-light);
    font-size: 15px;
}

.card-metrics-row {
    display: flex;
    gap: 24px;
}

.circular-metric {
    display: flex;
    align-items: center;
    gap: 12px;
}

.circle-chart {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: conic-gradient(var(--rs-green) 0%, var(--rs-border) 0%);
}

.circle-chart::before {
    content: "";
    position: absolute;
    inset: 3px;
    background: white;
    border-radius: 50%;
}

.circle-inner {
    position: relative;
    font-weight: 700;
    font-size: 13px;
    color: var(--rs-black);
    z-index: 1;
}

.metric-label {
    font-size: 12px;
    line-height: 1.4;
    color: var(--rs-black);
    font-weight: 500;
}

/* Card Bottom */
.card-bottom-row {
    border-top: 1px solid var(--rs-border);
    padding: 16px 0;
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 24px;
}

.compare-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    position: relative;
    color: var(--rs-black);
}

.compare-checkbox-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-custom {
    width: 22px;
    height: 22px;
    border: 1px solid #9ca3af;
    border-radius: 4px;
    display: inline-block;
    position: relative;
}

.compare-checkbox-label input:checked ~ .checkbox-custom {
    background: white;
    border-color: var(--rs-black);
}

.compare-checkbox-label input:checked ~ .checkbox-custom::after {
    content: '';
    position: absolute;
    top: 2px; left: 6px;
    width: 7px; height: 12px;
    border: solid var(--rs-black);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Inline Action Button */
.btn-send-case.inline-case-btn {
    background: var(--rs-black);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-send-case.inline-case-btn.hidden {
    display: none;
}

/* Global header now used — old custom header removed */

.no-results-msg {
    padding: 24px;
    background: #fff;
    border: 1px solid var(--rs-border);
    border-radius: 8px;
}

.no-results-msg h3 {
    margin: 0 0 8px 0;
    color: var(--rs-green);
    font-weight: 600;
}

.no-results-msg p {
    margin: 0;
    color: var(--rs-text-light);
}

/* Responsive */
@media (max-width: 900px) {
    .top-grid {
        grid-template-columns: 1fr;
    }
    .top-sidebar {
        order: -1;
    }
    .search-input-group-distinct {
        flex-wrap: wrap;
        height: auto;
    }
    .search-input-group-distinct > * {
        height: 48px;
    }
    .category-dropdown-wrapper,
    .search-input-wrap {
        flex: 1 1 100%;
    }
    .btn-search-black {
        flex: 1 1 100%;
        justify-content: center;
    }
    .rs-nav {
        display: none;
    }
    .results-meta-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .card-info {
        margin-left: 0;
        margin-top: 160px;
    }
    .card-logo-container {
        position: relative;
        top: auto;
        left: auto;
    }
    .card-metrics-row {
        flex-wrap: wrap;
        gap: 16px;
    }
}

/* ============================================
   TEAM MEMBER AVATARS ON SEARCH CARDS
   ============================================ */

.card-team-row {
    display: flex;
    align-items: center;
    margin-top: 12px;
    gap: 0;
}

.card-team-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #fff;
    margin-left: -8px;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.card-team-avatar:first-child {
    margin-left: 0;
}

.card-team-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-team-avatar span {
    font-size: 13px;
    font-weight: 700;
    color: #6b7280;
}

.card-team-more {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #fff;
    margin-left: -8px;
    background: var(--rs-green-light, rgba(0, 100, 224, 0.08));
    color: var(--rs-green, #0064E0);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ============================================
   REVIEW QUOTE SNIPPETS ON SEARCH CARDS
   ============================================ */

.card-review-quotes {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-review-quote {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f0fdf4;
    border-left: 3px solid var(--rs-green, #0064E0);
    border-radius: 0 6px 6px 0;
    font-size: 12.5px;
}

.card-review-quote .quote-text {
    flex: 1;
    color: #374151;
    font-style: italic;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-review-quote .quote-date {
    color: #9ca3af;
    font-size: 11px;
    white-space: nowrap;
    font-style: normal;
}

/* ── Responsive for new card elements ── */
@media (max-width: 600px) {
    .card-review-quote {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    .card-review-quote .quote-text {
        white-space: normal;
    }
}
