/* ZIP Code Lookup Widget Styles */
.ohra-zip-lookup-widget {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ohra-zip-lookup-widget.compact {
    padding: 16px;
    margin: 12px 0;
}

.zip-lookup-header h3 {
    color: #246234;
    font-size: 24px;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.zip-lookup-header .description {
    color: #666;
    font-size: 14px;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.ohra-zip-lookup-widget.compact .zip-lookup-header h3 {
    font-size: 20px;
}

.ohra-zip-lookup-widget.compact .zip-lookup-header .description {
    margin-bottom: 16px;
}

/* Input Group Styles */
.zip-lookup-form .input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: stretch;
}

.zip-lookup-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    min-width: 0;
}

.zip-lookup-input:focus {
    outline: none;
    border-color: #246234;
    box-shadow: 0 0 0 3px rgba(36, 98, 52, 0.1);
}

.zip-lookup-search-btn {
    background: #246234;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 120px;
}

.zip-lookup-search-btn:hover {
    background: #1a4d29;
    transform: translateY(-1px);
}

.zip-lookup-search-btn:active {
    transform: translateY(0);
}

.zip-lookup-search-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Region Selector Styles */
.region-selector {
    border-top: 1px solid #eee;
    padding-top: 16px;
}

.region-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.region-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.region-select:focus {
    outline: none;
    border-color: #246234;
    box-shadow: 0 0 0 3px rgba(36, 98, 52, 0.1);
}

/* Results Styles */
.zip-lookup-results {
    margin-top: 24px;
    border-top: 1px solid #eee;
    padding-top: 24px;
}

.search-results-header h4,
.region-results-header h4 {
    color: #246234;
    font-size: 20px;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.region-results-header .region-description {
    color: #666;
    font-style: italic;
    margin-bottom: 8px;
}

.rep-count {
    color: #246234;
    font-weight: 500;
    margin-bottom: 16px;
}

.result-section {
    margin-bottom: 24px;
}

.result-section h5 {
    color: #246234;
    font-size: 18px;
    margin: 0 0 4px 0;
    font-weight: 600;
}

.result-description {
    color: #666;
    margin: 0 0 16px 0;
    font-size: 14px;
}

/* Representatives Grid */
.representatives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.representative-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.3s ease;
}

.representative-card:hover {
    border-color: #246234;
    box-shadow: 0 4px 12px rgba(36, 98, 52, 0.1);
    transform: translateY(-2px);
}

.rep-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.rep-name {
    color: #246234;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.rep-party {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rep-party.republican {
    background: #fee;
    color: #c53030;
}

.rep-party.democrat {
    background: #eff6ff;
    color: #2563eb;
}

.rep-party.independent {
    background: #f0f0f0;
    color: #4a5568;
}

.rep-details {
    margin-bottom: 12px;
}

.rep-details p {
    margin: 4px 0;
    font-size: 14px;
    color: #666;
}

.rep-district {
    font-weight: 500;
    color: #246234;
}

.rep-email a {
    color: #246234;
    text-decoration: none;
}

.rep-email a:hover {
    text-decoration: underline;
}

.select-rep-btn {
    background: #246234;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.select-rep-btn:hover {
    background: #1a4d29;
}

/* No Results / Suggestions */
.no-results {
    text-align: center;
    padding: 24px;
    color: #666;
}

.suggestions-list {
    list-style: none;
    padding: 0;
    margin: 16px 0 0 0;
    text-align: left;
}

.suggestions-list li {
    margin: 8px 0;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
}

.suggestion-link {
    color: #246234;
    text-decoration: none;
    font-weight: 500;
}

.suggestion-link:hover {
    text-decoration: underline;
}

.suggestion-desc {
    color: #666;
    font-size: 12px;
}

/* Error Styles */
.zip-lookup-error {
    background: #ffeaa7;
    border: 1px solid #fdcb6e;
    border-radius: 6px;
    padding: 12px 16px;
    margin-top: 16px;
    color: #2d3436;
}

.zip-lookup-error p {
    margin: 0;
    font-size: 14px;
}

/* Loading States */
.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-loading::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ohra-zip-lookup-widget {
        padding: 16px;
        margin: 16px 0;
    }
    
    .zip-lookup-form .input-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .zip-lookup-search-btn {
        width: 100%;
    }
    
    .representatives-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .zip-lookup-header h3 {
        font-size: 20px;
    }
    
    .rep-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .ohra-zip-lookup-widget {
        padding: 12px;
        margin: 12px 0;
    }
    
    .zip-lookup-header h3 {
        font-size: 18px;
    }
    
    .zip-lookup-input,
    .region-select {
        padding: 10px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .representative-card {
        padding: 12px;
    }
}

/* Integration with existing advocacy tool styles */
.ohra-advocacy-tool .ohra-zip-lookup-widget {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
}

.ohra-advocacy-tool .ohra-zip-lookup-widget .zip-lookup-header h3 {
    font-size: inherit;
    margin-bottom: 16px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .representative-card {
        border-width: 2px;
    }
    
    .zip-lookup-input,
    .region-select {
        border-width: 2px;
    }
    
    .rep-party {
        border: 1px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .representative-card,
    .zip-lookup-search-btn,
    .zip-lookup-input,
    .region-select {
        transition: none;
    }
    
    .representative-card:hover {
        transform: none;
    }
    
    .zip-lookup-search-btn:hover {
        transform: none;
    }
    
    @keyframes spin {
        to {
            transform: none;
        }
    }
}
