/* Layout Wrapper */
.va-main-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

@media (min-width: 1024px) {
    .va-main-grid {
        grid-template-columns: repeat(12, minmax(0, 1fr));
        align-items: start;
    }
}

.va-container [type=button]:focus, 
.va-container [type=button]:hover, 
.va-container [type=submit]:focus, 
.va-container [type=submit]:hover, 
.va-container button:focus, 
.va-container button:hover {
    background-color: #f1f1f1;
}

.va-container .va-location-header {
    text-align: center;
    border: 1px solid #ccc;
    background: #ffffffcc;
    border-radius: 30px;
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
}
.va-container .va-location-header p {
    margin: 5px 15px;
    line-height: 25px;
}

/* Sidebar List */
.va-results-list {
    grid-column: span 4 / span 4;
    /* display: flex;* */
    /* flex-direction: column; */
    /* gap: 0.75rem; */
}

/* Container and Search Box */
.va-container {
    /* max-width: 800px; */
    margin: 20px auto;
    font-family: var(--e-global-typography-text-font-family, 'Inter', sans-serif);
    container-type: inline-size;
    container-name: va-widget;
}

.va-results {
    container-type: inline-size;
    container-name: va-results;
}

.va-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    margin-bottom: 30px;
}

.va-input {
    flex: 1;
    border: none !important;
    padding: 12px 20px;
    font-size: 16px;
    outline: none;
}

.va-search-btn {
    border-radius: 12px;
    padding: 12px 24px;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

/* Accent Bars */
.va-accent-bar {
    width: 4px;
    height: 2.5rem;
    border-radius: 99px;
    margin-right: 1rem;
}
.va-dem .va-accent-bar { background-color: #2563eb; }
.va-rep .va-accent-bar { background-color: #dc2626; }

/* Detail Panel */
.va-detail-panel {
    grid-column: span 8 / span 8;
    background: white;
    border-radius: 1.5rem;
    padding: 2.5rem;
    border: 1px solid  oklch(96.8% .007 247.896);
    min-height: 500px;
    display: block;
    top: 2rem;
    position: sticky;
    overflow: hidden;
}

.va-detail-top {
    height: 0.5rem;
    left: 0rem;
    right: 0rem;
    position: absolute;
    top: 0rem;
}
.va-detail-top.va-rep {
    background-color: #dc2626;
}
.va-detail-top.va-dem {
    background-color: #2563eb;
}

.va-placeholder-icon {
    width: 80px;
    height: 80px;
    background: #f1f5f9;
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: #94a3b8;
}

/* Results Cards - Matching the React Detail Panel */
.va-results-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.va-card {
    background: white;
    border-radius: 1rem;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    width: 100%;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.va-card:hover {
    transform: translateY(-4px);
    background: #f8fafc;
    border-color: #cbd5e1;
}

.va-card.active {
    border-color: #6366f1;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    background: white;
}

.va-office,
.va-rep-name,
.va-dem-name,
.va-contact-text p {
    text-wrap: auto;
}

.va-party-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.va-rep-name {
    margin:0; 
    font-weight:600;
}

.va-office {
    margin:0; 
    font-size: 0.875rem; 
    color: #64748b;
}

/* Photo Handling */
.va-photo-wrapper {
    width: 160px;
    height: 160px;
    border-radius: 99px;
    background: #f1f5f9;
    padding: 6px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.va-photo-wrapper img.va-leg-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 99px;
}

/* Large Party Badge */
.va-party-badge-lg {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.va-dem.va-party-badge-lg { background-color: #dbeafe; color: #1d4ed8; }
.va-rep.va-party-badge-lg { background-color: #fee2e2; color: #dc2626; }

.va-party-badge-lg span {
    display: inline-block;
    width: 0.35rem;
    height: 0.35rem;
    border-radius: 999px;
    background-color: currentColor;
    margin-right: 5px;
    margin-bottom: 2px;
}

/* Contact and Links Cards */
.va-contact-card,
.va-links-card {
    background: white;
    border-radius: 1rem;
    border: 0px solid #e2e8f0;
    overflow: hidden;
}

.va-card-header {
    background: transparent;
    padding: 0.25rem 0;
    border-bottom: 0px solid #e2e8f0;
    font-weight: 600;
    color: #64748b;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.va-contact-actions {
    padding: 1rem 0rem;
    display: grid;
    gap: calc(.25rem * 4);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.va-contact-btn {
    display: flex;
    width: 100%;
    text-align: left;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 1rem;
    border-color: oklch(92.9% .013 255.508);
    border-style: solid;
    border-width: 1px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.va-contact-icon {
    padding: 0.75rem;
    border-radius: 0.75rem;
    color: #4f46e5;
    background-color: color-mix(in srgb, #4f46e5 10%, transparent);
}
.va-contact-facebook-btn .va-contact-icon {
    color: #1877f2;
    background-color: color-mix(in srgb, #1877f2 10%, transparent);
}
.va-contact-twitter-btn .va-contact-icon {
    color: #1da1f2;
    background-color: color-mix(in srgb, #1da1f2 10%, transparent);
}

/* First <p> element in contact text is the label, second is the value */
.va-contact-text p:first-child {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: calc(1 / 0.75);
    font-size: 0.75rem;
    color: oklch(70.4% .04 256.788);
    margin-bottom: 0.125rem;
}
.va-contact-text p:last-child {
    font-size: 1.125rem;
    line-height: calc(1.75 / 1.125);
    color: oklch(20.8% .042 265.755);
    font-weight: 500;
    --tw-font-weight: 500;
}

.va-contact-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.va-contact-row:last-of-type {
    border-bottom: none;
}

.va-action-link {
    font-weight: 600;
    text-decoration: none;
    color: #1e293b;
}

/* Social Buttons */
.va-social-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
}

.va-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.va-social-btn.twitter { background: #1da1f2; color: white; }
.va-social-btn.facebook { background: #1877f2; color: white; }
.va-social-btn.website { background: #64748b; color: white; }

.va-social-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* ============================================================
   Responsive: small containers (popups) and mobile devices.
   Uses container queries so the widget adapts to its actual
   container width, not just the viewport.
   ============================================================ */

/* Prevent flex children from forcing horizontal overflow */
.va-input {
    min-width: 0;
}
.va-contact-text {
    min-width: 0;
    overflow: hidden;
}
.va-contact-text p:last-child {
    overflow-wrap: anywhere;
}

/* Stack list above detail when the results area is narrow */
@container va-results (max-width: 640px) {
    .va-main-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1rem;
    }
    .va-results-list,
    .va-detail-panel {
        grid-column: 1 / -1;
    }
    .va-card {
        padding: 0.5rem 1rem;
        margin: 5px 0;
    }
    .va-detail-panel {
        position: relative;
        top: auto;
        padding: 1.25rem;
        min-height: 0;
        border-radius: 1rem;
    }
}

/* Tighten the detail header and switch contact buttons to single column */
@container va-results (max-width: 480px) {
    .va-detail-content > div:first-child {
        margin-bottom: 1.25rem !important;
    }
    .va-detail-content > div:first-child > div:first-child {
        gap: 1rem !important;
        flex-wrap: wrap;
    }
    .va-photo-wrapper {
        width: 96px;
        height: 96px;
    }
    .va-contact-actions {
        grid-template-columns: 1fr;
        padding: 0.75rem 0;
    }
    .va-contact-btn {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    .va-contact-text p:last-child {
        font-size: 1rem;
        line-height: 1.4;
    }
    .va-party-badge-lg {
        padding: 0.25rem 0.6rem;
        font-size: 0.7rem;
    }
}

/* Search form shrinks on narrow widget containers */
@container va-widget (max-width: 480px) {
    .va-search-wrapper {
        padding: 6px;
        border-radius: 12px;
        margin-bottom: 16px;
    }
    .va-input {
        padding: 10px 12px;
        font-size: 14px;
    }
    .va-search-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* Very narrow: stack the search button under the input */
@container va-widget (max-width: 360px) {
    .va-search-wrapper {
        flex-wrap: wrap;
    }
    .va-search-btn {
        flex: 1 1 100%;
    }
}