/* Audience Selector Component Styles */

.audience-selector {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    min-height: 500px;
}

/* Quick Groups Section */
.quick-groups-section h5 {
    font-weight: 600;
    color: #333;
}

.quick-groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 1rem;
}

.quick-group-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
    min-height: 80px;
}

.quick-group-btn:hover {
    border-color: #1b6ec2;
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.quick-group-btn.active {
    border-color: #1b6ec2;
    background: #1b6ec2;
    color: white;
}

.quick-group-btn.active:hover {
    background: #155a9e;
    border-color: #155a9e;
}

.quick-group-btn .group-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.quick-group-btn .group-name {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-align: center;
}

.quick-group-btn .group-count {
    font-size: 1.25rem;
    font-weight: 700;
}

.quick-group-btn.active .group-name,
.quick-group-btn.active .group-count {
    color: white;
}

/* Search Section */
.search-section h5 {
    font-weight: 600;
    color: #333;
}

.search-section .input-group {
    margin-bottom: 0.5rem;
}

.search-section .input-group .form-control {
    border-right: none;
}

.search-section .input-group .btn-outline-secondary {
    border-left: none;
    background: white;
}

.search-results {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
    max-height: 400px;
    overflow-y: auto;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    font-size: 0.875rem;
    color: #666;
    position: sticky;
    top: 0;
    z-index: 10;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-results-list {
    padding: 0.5rem;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f8f9fa;
}

.search-result-item .form-check-input {
    margin-right: 1rem;
    flex-shrink: 0;
}

.search-result-item .user-info {
    flex: 1;
}

.search-result-item .user-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.25rem;
}

.search-result-item .user-email {
    font-size: 0.875rem;
    color: #666;
}

/* Recipients Summary Section */
.recipients-summary {
    margin-top: 2rem;
    padding: 1rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.recipients-summary h5 {
    font-weight: 600;
    color: #333;
}

.recipients-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recipients-count .badge {
    font-size: 1rem;
    padding: 0.5rem 1rem;
}

.selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.selected-items .badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.selected-items .badge .btn-close {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    opacity: 0.8;
}

.selected-items .badge .btn-close:hover {
    opacity: 1;
}

/* Email Composer Container */
.email-composer-container {
    padding: 1.5rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    min-height: 500px;
}

.email-composer-container h5 {
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
}

.email-composer-container .alert-info {
    background: #e7f3ff;
    border-color: #b3d9ff;
    color: #004085;
}

/* Audience Selector Container */
.audience-selector-container {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* Scrollbar Styling */
.search-results::-webkit-scrollbar,
.audience-selector-container::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track,
.audience-selector-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb,
.audience-selector-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb:hover,
.audience-selector-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Selection Chips - Phase 1 */
.selection-chip-list {
    margin-bottom: 1rem;
}

.chip-list-empty {
    padding: 1rem;
    text-align: center;
    color: #6c757d;
    font-size: 0.875rem;
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
}

.chip-list-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    min-height: 60px;
}

/* Individual Selection Chip */
.selection-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    border: 2px solid;
}

/* Include Mode - Blue */
.selection-chip.chip-include {
    background: #e7f3ff;
    border-color: #1b6ec2;
    color: #004085;
}

.selection-chip.chip-include:hover {
    background: #cce5ff;
    border-color: #155a9e;
    box-shadow: 0 2px 4px rgba(27, 110, 194, 0.2);
}

/* Exclude Mode - Red */
.selection-chip.chip-exclude {
    background: #ffe7e7;
    border-color: #dc3545;
    color: #721c24;
}

.selection-chip.chip-exclude:hover {
    background: #ffcccc;
    border-color: #c82333;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

/* Chip Icon */
.chip-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Chip Label */
.chip-label {
    flex: 1;
    white-space: nowrap;
}

/* Chip Count Badge */
.chip-count {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

.selection-chip.chip-include .chip-count {
    background: rgba(27, 110, 194, 0.15);
    color: #004085;
}

.selection-chip.chip-exclude .chip-count {
    background: rgba(220, 53, 69, 0.15);
    color: #721c24;
}

/* Chip Remove Button */
.chip-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 1rem;
    line-height: 1;
    color: inherit;
}

.chip-remove-btn:hover {
    background: rgba(0, 0, 0, 0.25);
    transform: scale(1.1);
}

.chip-remove-btn span {
    display: block;
    margin-top: -2px;
}

/* Responsive Design */
@media (max-width: 991px) {
    .audience-selector-container {
        position: relative;
        top: 0;
        max-height: none;
        margin-bottom: 2rem;
    }

    .quick-groups-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@media (max-width: 576px) {
    .quick-groups-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .search-results {
        max-height: 300px;
    }

    .email-composer-container {
        padding: 1rem;
    }
}
