/* Chats Page Styles */

.chats-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

.chats-header {
    text-align: center;
    margin-bottom: 2rem;
}

.chats-header h2 {
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.chats-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.chats-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    min-height: 400px;
    overflow-x: auto;
}

.chats-actions {
    margin-bottom: 2rem;
    display: flex;
    justify-content: flex-end;
}



/* 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.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 5% auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

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

.form-group:last-child {
    margin-bottom: 0;
}

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

.form-select {
	width: 100%;
	padding: 0.75rem 2.5rem 0.75rem 0.75rem;
	border: 1px solid var(--border-color);
	border-radius: 8px;
	background-color: var(--bg-primary);
	color: var(--text-primary);
	font-size: 1rem;
	transition: all 0.2s ease;
	appearance: none;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right 1rem center;
	background-size: 16px;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Custom multiselect styles */
.custom-multiselect {
    position: relative;
    width: 100%;
}

.multiselect-display {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    min-height: 48px;
}

.multiselect-display:hover {
    border-color: var(--accent-color);
}

.multiselect-display:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
}

.placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.selected-item {
    background-color: var(--accent-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.remove-item {
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    line-height: 1;
}

.remove-item:hover {
    opacity: 0.8;
}

.dropdown-arrow {
    transition: transform 0.2s ease;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.multiselect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

/* Disease dropdown should overflow modal boundaries */
#disease-dropdown {
    z-index: 9999;
    position: fixed;
    width: auto;
    min-width: 300px;
    max-width: 500px;
}

.multiselect-dropdown::-webkit-scrollbar {
    width: 6px;
}

.multiselect-dropdown::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 3px;
}

.multiselect-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.multiselect-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.multiselect-options {
    padding: 0;
    background-color: var(--bg-secondary);
    border-radius: 8px;
}

.multiselect-option {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.multiselect-option:last-child {
    border-bottom: none;
}

.multiselect-option:hover {
    background-color: var(--bg-hover);
}

.multiselect-option input[type="checkbox"] {
    margin-right: 0.75rem;
    margin-top: 0.125rem;
    cursor: pointer;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.multiselect-option label {
    cursor: pointer;
    flex: 1;
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.4;
    word-wrap: break-word;
    padding: 0;
    margin: 0;
}

.virtual-patient-selectors {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.patient-selector {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.patient-search-input {
    position: relative;
}

.patient-dropdown {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.patient-option {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.patient-option:hover {
    background-color: var(--bg-hover);
}

.patient-option:last-child {
    border-bottom: none;
}

.patient-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.patient-details {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
}

.patient-selected {
    background-color: var(--accent-color);
    color: white;
}

.patient-selected .patient-name,
.patient-selected .patient-details {
    color: white;
}

/* Pagination */

/* Targets Search Styles */
.targets-search-input {
    background-image: none !important;
    padding-right: 0.75rem !important;
}

.targets-dropdown {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.target-option {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.target-option:last-child {
    border-bottom: none;
}

.target-option:hover {
    background-color: var(--bg-tertiary);
}

.target-option.selected {
    background-color: rgba(59, 130, 246, 0.1);
}

.target-option.no-targets {
    color: var(--text-secondary);
    font-style: italic;
    cursor: default;
}

.target-option.no-targets:hover {
    background-color: transparent;
}

.target-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.target-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.target-name {
    font-weight: 500;
    color: var(--text-primary);
}

.target-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.target-type {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    white-space: nowrap;
}

/* Selected Targets Display */
.selected-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.selected-target-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: var(--accent-color);
    color: white;
    border-radius: 6px;
    font-size: 0.875rem;
}

.target-tag-name {
    font-weight: 500;
}

.target-tag-type {
    opacity: 0.8;
}

.target-tag-remove {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.target-tag-remove:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
    border-left: 3px solid #ef4444;
}

/* Loading Overlay */
.chat-loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.chat-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 3rem;
    background-color: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.chat-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.chat-loading-text {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 500;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .chats-container {
        padding: 1rem;
    }
    
    .chats-header h2 {
        font-size: 1.5rem;
    }
    
    .chats-content {
        padding: 1rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}
