* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(to right, rgba(198, 40, 40, 0.7), rgba(21, 101, 192, 0.7));
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(21, 101, 192, 0.1) 0%, rgba(255, 255, 255, 0.05) 50%, rgba(198, 40, 40, 0.1) 100%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 20px;
    background: linear-gradient(135deg, #1565c0 0%, #c62828 100%);
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.game-button {
    display: inline-block;
    margin-top: 15px;
    padding: 12px 25px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.game-button:hover {
    background: linear-gradient(135deg, #f7931e 0%, #ff6b35 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.filters {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px 15px;
    border-radius: 8px;
    margin-bottom: 30px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.filters input, .filters select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.filters button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
}

.filters button:hover {
    background: #764ba2;
}

.legislators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.legislator-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.legislator-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-image {
    width: 100%;
    height: 250px;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-image .placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0e0e0 0%, #d0d0d0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: #999;
}

.card-content {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow flex shrinking */
}

.card-name {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    margin-bottom: 6px;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.6em; /* Ensure consistent height for 2 lines */
}

.card-district {
    color: #667eea;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.party-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 15px;
}

.party-republican {
    background: #ffebee;
    color: #c62828;
}

.party-democrat {
    background: #e3f2fd;
    color: #1565c0;
}

.card-info {
    font-size: 0.95em;
    color: #666;
    line-height: 1.6;
}

.card-info p {
    margin-bottom: 8px;
}

.info-label {
    font-weight: 600;
    color: #333;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: white;
    padding: 40px;
    font-size: 1.2em;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.close-button {
    position: absolute;
    right: 20px;
    top: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.close-button:hover {
    color: #666;
}

.modal-header {
    display: flex;
    padding: 30px;
    background: linear-gradient(135deg, #1565c0 0%, #c62828 100%);
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-photo {
    flex-shrink: 0;
    margin-right: 25px;
}

.modal-photo img {
    width: 120px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.modal-basic-info {
    flex: 1;
}

.modal-basic-info h2 {
    margin: 0 0 10px 0;
    font-size: 2em;
    font-weight: 700;
}

.modal-district {
    font-size: 1.2em;
    margin-bottom: 15px;
    opacity: 0.9;
}

.modal-id {
    font-size: 1em;
    margin-bottom: 15px;
    opacity: 0.8;
    font-weight: 500;
}

.modal-details {
    padding: 30px;
}

.detail-section h3 {
    color: #333;
    font-size: 1.4em;
    margin-bottom: 20px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-label {
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item span:last-child {
    color: #333;
    font-size: 1em;
}

.modal-actions {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.bio-link {
    display: inline-block;
    padding: 12px 25px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.bio-link:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.stats {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stats span {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
}
footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: #4a5568;
    font-size: 0.9em;
}
