/* Search Form Styling */
#congress-search-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 20px auto;
    max-width: 600px;
    padding: 15px;
    background: #1e1e1e;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

#congress-search {
    flex-grow: 1;
    padding: 12px;
    font-size: 16px;
    color: #ffffff;
    background: #262626;
    border: 1px solid #444;
    border-radius: 6px;
    outline: none;
    box-sizing: border-box;
}

#congress-search::placeholder {
    color: #888;
}

#congress-search:focus {
    border-color: #00bcd4;
}

/* Search Button */
#congress-search-form button {
    padding: 12px 20px;
    font-size: 16px;
    color: #ffffff;
    background: #00bcd4;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#congress-search-form button:hover {
    background: #0097a7;
}

/* Results Container */
#congress-results {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: #1e1e1e;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

/* Member Card */
.member-card {
    background: #262626;
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    position: relative;
}

.member-card:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

/* Member Photo */
.member-photo {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #00bcd4;
    flex-shrink: 0;
}

/* Member Info */
.member-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

/* Name Styling */
.member-name {
    font-size: 22px;
    font-weight: bold;
    color: #ffffff;
    display: block;
}

/* Role & State */
.role {
    font-size: 16px;
    font-weight: normal;
    color: #ccc;
}

/* Term */
.term {
    font-size: 14px;
    font-weight: normal;
    color: #999;
    margin-top: 5px;
}

/* Member Scores Section */
.member-scores {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.member-scores > span:last-child:nth-child(2n + 1) {
    grid-column: 1 / -1;
}

.member-scores span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    background: rgba(0, 188, 212, 0.2);
    padding: 6px 10px;
    border-radius: 6px;
    color: #fff;
}

.member-scores span strong {
    color: #00bcd4;
    white-space: nowrap;
}

/* Congress Members Grid */
.congress-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background: #1e1e1e;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

/* Member Header */
.member-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #444;
}

.member-photo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #00bcd4;
    flex-shrink: 0;
}

.member-basic-info {
    text-align: left;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.member-name {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    display: block;
    margin-bottom: 5px;
}

.role {
    font-size: 14px;
    color: #bbb;
}

/* Search Box */
#congress-search-container {
    display: flex;
    justify-content: center;
    margin: 20px auto;
    max-width: 600px;
    padding: 15px;
    background: #1e1e1e;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

#congress-search {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    color: #ffffff;
    background: #262626;
    border: 1px solid #444;
    border-radius: 6px;
    outline: none;
}

#congress-search::placeholder {
    color: #888;
}

#congress-search:focus {
    border-color: #00bcd4;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .congress-grid {
        /* grid-template-columns: repeat(2, 1fr); */
    }
    
    /* Handle uneven number of cards in 2-column layout */
    .congress-grid .member-card:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1024px) {
    .most-wanted-grid {
        grid-template-columns: 1fr !important;
        max-width: 800px !important;
    }
}

@media (max-width: 768px) {
    .congress-grid {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    
    .member-scores {
        grid-template-columns: 1fr;
    }
    
    .most-wanted-section {
        padding: 20px;
    }
    
    .most-wanted-title {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .member-card {
        padding: 15px;
    }
    
    .member-header {
        gap: 10px;
    }
    
    .member-photo {
        width: 60px;
        height: 60px;
    }
    
    .member-name {
        font-size: 16px;
    }
    
    .role {
        font-size: 12px;
    }
    
    .member-scores span {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* Most Wanted Section */
.most-wanted-section {
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(145deg, #2a2a2a, #1e1e1e);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    border: 2px solid #ff4444;
}

.most-wanted-title {
    text-align: center;
    color: #ff4444;
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 30px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
    letter-spacing: 2px;
}

.most-wanted-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

/* Handle uneven number of cards in most-wanted grid */
.most-wanted-grid .member-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.member-card.most-wanted {
    background: linear-gradient(145deg, #2d2d2d, #262626);
    border: 1px solid #ff4444;
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.2);
}

.member-card.most-wanted:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(255, 68, 68, 0.3);
}

.member-card.most-wanted .member-header {
    border-bottom-color: #ff4444;
}

.member-card.most-wanted .member-photo {
    border-color: #ff4444;
}

.member-card.most-wanted .member-name {
    color: #ff4444;
}

.member-card.most-wanted .member-scores span {
    background: rgba(255, 68, 68, 0.2);
}

.member-card.most-wanted .member-scores span strong {
    color: #ff4444;
}

/* Handle uneven number of cards in congress grid */
.congress-grid .member-card:last-child:nth-child(3n+1) {
    grid-column: 1 / -1;
}

.congress-grid .member-card:last-child:nth-child(3n+2) {
    grid-column: 1 / 3;
}

.search-section {
    margin-top: 3rem;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 0, 0, 0.2);
}

.search-title {
    text-align: center;
    color: #fff;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
}

.search-container {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.search-container input {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 0, 0, 0.3);
    border-radius: 5px;
    color: #fff;
    transition: all 0.3s ease;
}

.search-container input:focus {
    outline: none;
    border-color: #ff0000;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.2);
}

.search-container input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.most-wanted-section {
    margin-bottom: 3rem;
}

@media (max-width: 768px) {
    .search-section {
        padding: 1rem;
        margin-top: 2rem;
    }

    .search-title {
        font-size: 1.5rem;
    }

    .search-container {
        margin-bottom: 1.5rem;
    }
}

/* Status Indicators */
.status-indicator, .status-tag {
    display: inline-block;
    padding: 4px 8px;
    margin: 5px 5px 5px 0;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-indicator.former, .status-tag.former {
    background-color: #555555;
    color: #ffffff;
    border: 1px solid #777777;
}

.status-indicator.retiring, .status-tag.retiring {
    background-color: #8e44ad;
    color: #ffffff;
    border: 1px solid #9b59b6;
}

/* Status tags in modal */
.status-tag {
    align-self: flex-start;
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: 14px;
}

/* Responsive adjustments for status indicators */
@media (max-width: 768px) {
    .status-indicator {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .status-tag {
        font-size: 12px;
    }
}

/* RINOScorus Container with hover indicator */
.rinoscorus-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
    padding: 2px 4px;
    border-radius: 4px;
}

.rinoscorus-container::after {
    content: "ℹ️";
    margin-left: 5px;
    font-size: 12px;
    opacity: 0.7;
}

/* RINOScorus™ Tooltip */
.rinoscorus-tooltip {
    display: none;
    position: fixed;
    background: #1e1e1e;
    border: 1px solid #ff4444;
    border-radius: 8px;
    padding: 15px;
    z-index: 1000;
    min-width: 250px;
    max-width: 300px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-size: 14px;
    line-height: 1.5;
    pointer-events: none;
}

.rinoscorus-container:hover .rinoscorus-tooltip {
    display: block;
}

/* Common styles for detailed scores (both tooltip and mobile) */
.rinoscorus-tooltip h4,
.detailed-scores h4 {
    color: #ff4444;
    margin: 0 0 10px 0;
    font-size: 16px;
}

.rinoscorus-tooltip ul,
.detailed-scores ul {
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
}

.rinoscorus-tooltip li,
.detailed-scores li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    color: #fff;
}

.rinoscorus-tooltip .score-value,
.detailed-scores .score-value {
    color: #00bcd4;
    font-weight: bold;
    margin-left: 10px;
}

.rinoscorus-tooltip .note,
.detailed-scores .note {
    font-size: 12px;
    color: #888;
    font-style: italic;
    margin-top: 10px;
    border-top: 1px solid rgba(255, 68, 68, 0.2);
    padding-top: 10px;
}

/* Mobile detailed scores section */
.mobile-detailed-scores {
    display: none; /* Hidden by default */
    margin-top: 15px;
    padding: 15px;
    background: rgba(30, 30, 30, 0.7);
    border: 1px solid rgba(255, 68, 68, 0.4);
    border-radius: 8px;
}

/* Mobile toggle button for detailed scores */
.mobile-scores-toggle {
    display: none; /* Hidden by default */
    width: 100%;
    margin-top: 12px;
    padding: 12px 15px;  /* Increased padding for better tap target */
    background: rgba(0, 188, 212, 0.2);
    border: 1px solid rgba(0, 188, 212, 0.4);
    border-radius: 6px;
    color: #00bcd4;
    text-align: center;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 16px; /* Larger font size */
    -webkit-tap-highlight-color: rgba(0, 188, 212, 0.3); /* Better touch feedback */
    user-select: none; /* Prevent text selection on tap */
}

.mobile-scores-toggle:hover, .mobile-scores-toggle:focus {
    background: rgba(0, 188, 212, 0.3);
}

.mobile-scores-toggle:active {
    background: rgba(0, 188, 212, 0.5); /* Darker background on touch */
}

.mobile-scores-toggle.active {
    background: rgba(0, 188, 212, 0.4);
    border-color: #00bcd4;
    border-radius: 6px 6px 0 0;
}

/* Media queries for responsive behavior */
@media (max-width: 768px) {
    /* Hide tooltip on mobile */
    .rinoscorus-container::after {
        display: none;
    }
    
    .rinoscorus-container:hover .rinoscorus-tooltip {
        display: none;
    }
    
    /* Show mobile toggle button but keep detailed scores hidden by default */
    .mobile-scores-toggle {
        display: block;
        margin-bottom: 5px; /* Add space after button */
    }
    
    /* Keep mobile-detailed-scores hidden until toggled */
    .mobile-detailed-scores {
        display: none;
        margin-bottom: 15px; /* Add space after details when shown */
    }
    
    /* Show when active class is added */
    .mobile-detailed-scores.active {
        display: block;
    }
    
    /* Other mobile styles */
    .member-card {
        padding: 15px;
        margin-bottom: 20px; /* Add space between cards */
    }
    
    .member-photo {
        width: 60px;
        height: 60px;
    }
    
    .member-scores {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) {
    /* Hide mobile detailed scores on desktop */
    .mobile-detailed-scores {
        display: none;
    }
    
    /* Show tooltip animation on desktop */
    .rinoscorus-container:hover .rinoscorus-tooltip {
        animation: fadeIn 0.2s ease-in-out;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Mobile-specific enhancements */
.mobile-device .mobile-scores-toggle {
    padding: 15px 20px; /* Even larger tap targets on actual mobile devices */
    font-size: 18px;
    margin: 12px 0;
    background: rgba(0, 188, 212, 0.3); /* More visible by default */
}

.mobile-device .member-card {
    margin-bottom: 25px; /* More space between cards */
}

.mobile-device .mobile-detailed-scores {
    padding: 20px;
    margin: 10px 0 20px;
}

.mobile-device .member-scores span {
    padding: 10px; /* Larger touch targets */
}

/* Additional mobile-friendly improvements */
@media (max-width: 480px) {
    .member-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .member-photo {
        margin-bottom: 10px;
    }
    
    .member-basic-info {
        text-align: center;
    }
    
    .mobile-scores-toggle {
        margin-top: 15px;
    }
}

/* View Details Button */
.view-details-btn {
    display: block;
    width: 100%;
    padding: 10px 15px;
    margin: 15px 0;
    background-color: #ff4444;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-align: center;
}

.view-details-btn:hover {
    background-color: #cc0000;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: #1e1e1e;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #ff4444;
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    position: relative;
    color: white;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #ff4444;
    text-decoration: none;
    cursor: pointer;
}

.modal-member-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-member-card img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #ff4444;
    margin: 0 auto;
}

.modal-member-card h2 {
    color: #ff4444;
    text-align: center;
    margin-bottom: 5px;
}

.modal-member-card .role,
.modal-member-card .chamber {
    text-align: center;
    color: #aaa;
    margin-bottom: 10px;
}

.modal-member-card .term {
    text-align: center;
    color: #aaa;
    margin-bottom: 5px;
}

/* New condensed layout for role, chamber, and term information */
.modal-member-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.modal-member-info .info-item {
    flex: 1;
    min-width: 150px;
    text-align: center;
    padding: 10px;
    background-color: rgba(255, 68, 68, 0.1);
    border-radius: 5px;
}

.modal-member-info .info-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.modal-member-info .info-value {
    font-size: 16px;
    color: #fff;
    font-weight: bold;
}

.modal-member-card .member-scores {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.modal-member-card .member-scores h3 {
    grid-column: 1 / -1;
    color: #ff4444;
    text-align: center;
    margin-bottom: 10px;
}

.modal-member-card .member-scores span {
    background-color: rgba(255, 68, 68, 0.1);
    padding: 10px;
    border-radius: 5px;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-member-card .member-scores {
        grid-template-columns: 1fr;
    }
    
    .modal-member-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-member-info .info-item {
        min-width: 100%;
    }
}

/* RINO Assessment in Modal */
.rino-assessment {
    margin-top: 30px;
    border-top: 1px solid rgba(255, 68, 68, 0.3);
    padding-top: 20px;
}

.rino-assessment h3 {
    color: #ff4444;
    text-align: center;
    margin-bottom: 15px;
    font-size: 20px;
}

.assessment-content {
    background-color: rgba(255, 68, 68, 0.1);
    padding: 15px;
    border-radius: 5px;
    line-height: 1.6;
    font-size: 16px;
}

@media (max-width: 768px) {
    .assessment-content {
        font-size: 14px;
        padding: 12px;
    }
}