:root {
    --primary: #1a56db;
    --primary-hover: #1e40af;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --accent: #fcd34d;
    --red-accent: #ef4444;
    --border-radius: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
}

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

.header {
    background: linear-gradient(135deg, #0b2e59, #1a56db);
    color: white;
    padding: 5rem 0;
    text-align: center;
    border-bottom: 4px solid var(--accent);
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
}

.header p {
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.9;
}

.search-container {
    margin: -2rem auto 3rem;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 10;
}

#searchInput {
    width: 100%;
    max-width: 700px;
    padding: 1.25rem 2rem;
    font-size: 1.125rem;
    border: 2px solid transparent;
    border-radius: 9999px;
    box-shadow: var(--shadow-lg);
    outline: none;
    transition: all 0.3s ease;
    background-color: white;
}

#searchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(26, 86, 219, 0.15), var(--shadow-lg);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding-bottom: 4rem;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.results-count {
    font-size: 1.25rem;
    color: var(--text-main);
    font-weight: 600;
}

.btn-mail-all {
    display: inline-block;
    background: linear-gradient(135deg, #0b2e59, #1a56db);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 9999px;
    box-shadow: var(--shadow-md);
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-mail-all:hover {
    background: linear-gradient(135deg, #0a2648, #1747b8);
    box-shadow: var(--shadow-lg);
}

.btn-mail-all:active {
    transform: scale(0.98);
}

.mail-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn-copy-all {
    display: inline-block;
    background: transparent;
    border: 2px solid #e5e7eb;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 9999px;
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy-all:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.btn-copy-all:active {
    transform: scale(0.98);
}

.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-top: 5px solid var(--primary);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card.senat {
    border-top-color: var(--red-accent);
}

.card-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.badge-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    background-color: #e5e7eb;
    color: #374151;
}

.badge.cdep {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge.senat {
    background-color: #fee2e2;
    color: #b91c1c;
}

.info-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.info-label {
    font-weight: 600;
    margin-right: 0.5rem;
    color: var(--text-main);
}

.email-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    word-break: break-all;
}

.email-link:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: var(--text-muted);
    font-size: 1.25rem;
}

@media (max-width: 640px) {
    .header {
        padding: 3rem 0;
    }
    .header h1 {
        font-size: 2.25rem;
    }
    #searchInput {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    .filters-container {
        flex-direction: column;
        align-items: stretch;
    }
}

.filters-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: -1.5rem auto 3rem;
    max-width: 700px;
    z-index: 10;
    position: relative;
}

/* Custom Multi-Select */
.custom-multi-select {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.select-box {
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
    border: 2px solid transparent;
    border-radius: 9999px;
    box-shadow: var(--shadow-sm);
    background-color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.select-box:focus, .select-box.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(26, 86, 219, 0.15), var(--shadow-md);
    outline: none;
}

.select-box::after {
    content: "";
    width: 0.65rem;
    height: 0.65rem;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%236b7280%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    transition: transform 0.3s ease;
}

.select-box.active::after {
    transform: rotate(180deg);
}

.select-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
    padding-right: 0.5rem;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background-color: white;
    box-shadow: var(--shadow-lg);
    border-radius: 12px;
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
}

/* Custom Scrollbar for Dropdown */
.dropdown-content::-webkit-scrollbar {
    width: 6px;
}
.dropdown-content::-webkit-scrollbar-track {
    background: transparent;
}
.dropdown-content::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

.dropdown-content.show {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dropdown-content label {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    font-size: 0.95rem;
    user-select: none;
}

.dropdown-content label:hover {
    background-color: #f3f4f6;
}

.dropdown-content input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.email-warning {
    font-size: 0.75rem;
    color: #b45309;
    background-color: #fef3c7;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    margin-top: 1rem;
    text-align: center;
    border: 1px solid #fde68a;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.verified-badge {
    width: 18px;
    height: 18px;
    color: #3b82f6;
    vertical-align: middle;
    margin-left: 0.25rem;
    cursor: help;
}

/* Custom Tooltip */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
}

.tooltip-wrapper::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    font-weight: 500;
}

.tooltip-wrapper::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 100;
    pointer-events: none;
}

.tooltip-wrapper:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-2px);
}

.tooltip-wrapper:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    width: 90%;
    max-width: 650px;
    box-shadow: var(--shadow-lg);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--red-accent);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.modal-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.modal-input, .modal-textarea {
    width: 100%;
    padding: 0.85rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-input:focus, .modal-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.btn-send-modal {
    background: linear-gradient(135deg, #0b2e59, #1a56db);
    color: white;
    padding: 0.85rem 1.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-send-modal:hover {
    background: linear-gradient(135deg, #0a2648, #1747b8);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-send-modal:active {
    transform: scale(0.98);
}

/* Dropdown divider */
.dropdown-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 0.25rem 0;
}

.select-all-label {
    background-color: #f9fafb;
    border-radius: 6px;
    margin-bottom: 0.25rem;
}
