/**
 * SMS Queue Slideout Styles
 */

/* SMS Queue Slideout Panel */
#slideout_smsQueue {
    position: fixed;
    top: 0;
    right: -620px;
    width: 620px;
    height: 100%;
    background: #ffffff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease-in-out;
    z-index: 9998;
    overflow-y: auto;
}

#slideout_smsQueue.slideout_smsQueue_open {
    right: 44px;
}

/* Form Elements */
.sms_form_group {
    margin-bottom: 15px;
}

.sms_form_group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.sms_form_control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.sms_form_control:focus {
    border-color: #0989BD;
    box-shadow: 0 0 0 3px rgba(9, 137, 189, 0.15);
    outline: none;
}

textarea.sms_form_control {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* Buttons */
.sms_btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.sms_btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sms_btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sms_btn_primary {
    background: linear-gradient(135deg, #0989BD, #077a9e);
    color: white;
}

.sms_btn_primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #077a9e, #066a8a);
}

/* Filter Buttons */
.sms_filter_btn {
    padding: 6px 12px;
    margin-right: 4px;
    background: #e9ecef;
    color: #495057;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    opacity: 0.7;
}

.sms_filter_btn:hover {
    opacity: 1;
    background: #dee2e6;
}

.sms_filter_btn.active {
    opacity: 1;
    background: #0989BD;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Log Items */
.sms_log_item {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s;
}

.sms_log_item:hover {
    background-color: #f8f9fa;
}

.sms_log_item_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sms_log_recipient {
    font-weight: 600;
    font-size: 14px;
    color: #212529;
}

.sms_log_item_details {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
}

.sms_log_item_details div {
    display: inline-block;
    margin-right: 15px;
}

.sms_log_item_message {
    padding: 8px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
    color: #495057;
    font-style: italic;
}

.sms_log_item_error {
    margin-top: 8px;
    padding: 6px 10px;
    background: #f8d7da;
    border-radius: 4px;
    font-size: 12px;
    color: #842029;
}

/* Status Badges */
.sms_status_badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sms_status_delivered {
    background-color: #d1e7dd;
    color: #0f5132;
}

.sms_status_failed {
    background-color: #f8d7da;
    color: #842029;
}

.sms_status_pending {
    background-color: #fff3cd;
    color: #856404;
}

/* Empty State */
.sms_queue_empty {
    padding: 40px 20px;
    text-align: center;
    color: #6c757d;
}

.sms_queue_empty_icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.sms_queue_empty_text {
    font-size: 14px;
}

/* Loading State */
.sms_queue_loading {
    padding: 20px;
    text-align: center;
    color: #6c757d;
}

.sms_queue_loading_spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #0989BD;
    animation: sms_spinner 0.6s linear infinite;
}

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

/* Slideout Title */
#slideout_smsQueue .slideout_title {
    padding: 20px;
    text-align: center;
}

#slideout_smsQueue .slideout_title h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 700;
}

#slideout_smsQueue .slideout_title p {
    margin: 0;
    font-size: 14px;
}

/* Slideout Body */
#slideout_smsQueue .slideout_body {
    padding: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #slideout_smsQueue {
        width: 100%;
        right: -100%;
    }
}

/* Scrollbar styling */
#smsQueue_log_container::-webkit-scrollbar {
    width: 8px;
}

#smsQueue_log_container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#smsQueue_log_container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#smsQueue_log_container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================
   SMS MESSENGER TAB STYLES
   ============================================ */

/* Tab Navigation */
.sms_tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
}

.sms_tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.sms_tab:hover {
    color: #0989BD;
    background: rgba(9, 137, 189, 0.05);
}

.sms_tab.active {
    color: #0989BD;
    background: white;
}

.sms_tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #0989BD;
}

/* Tab Content */
.sms_tab_content {
    height: calc(100vh - 150px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Messenger Header / Search */
.sms_messenger_header {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
}

.sms_search_input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.sms_search_input:focus {
    border-color: #0989BD;
    box-shadow: 0 0 0 3px rgba(9, 137, 189, 0.1);
}

/* Search Results Dropdown */
.sms_search_results {
    position: absolute;
    left: 15px;
    right: 15px;
    top: 60px;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.sms_search_result_item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.sms_search_result_item:last-child {
    border-bottom: none;
}

.sms_search_result_item:hover {
    background: #f8f9fa;
}

.sms_search_result_name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.sms_search_result_phone {
    font-size: 12px;
    color: #6c757d;
    margin-top: 2px;
}

/* Conversation List */
#sms_conversations_container {
    flex: 1;
    overflow-y: auto;
}

.sms_conversation_item {
    display: flex;
    align-items: center;
    padding: 14px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.sms_conversation_item:hover {
    background: #f8f9fa;
}

.sms_conversation_item.unread {
    background: #e5f4f9;
}

.sms_conversation_avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0989BD, #077a9e);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    margin-right: 12px;
    flex-shrink: 0;
}

.sms_conversation_content {
    flex: 1;
    min-width: 0;
}

.sms_conversation_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.sms_conversation_name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sms_conversation_time {
    font-size: 11px;
    color: #999;
    flex-shrink: 0;
    margin-left: 8px;
}

.sms_conversation_preview {
    font-size: 13px;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sms_conversation_item.unread .sms_conversation_preview {
    font-weight: 600;
    color: #333;
}

.sms_unread_badge {
    background: #dc3545;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 8px;
}

/* Conversation Main (clickable area excluding archive button) */
.sms_conversation_main {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

/* Archive Button */
.sms_archive_btn {
    background: none;
    border: none;
    padding: 8px;
    margin-left: 8px;
    cursor: pointer;
    color: #aaa;
    border-radius: 4px;
    transition: all 0.15s;
    flex-shrink: 0;
    opacity: 0;
}

.sms_conversation_item:hover .sms_archive_btn {
    opacity: 1;
}

.sms_archive_btn:hover {
    background: #fee;
    color: #dc3545;
}

/* Empty State */
.sms_empty_state {
    text-align: center;
    padding: 60px 30px;
    color: #999;
}

.sms_empty_icon {
    font-size: 60px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.sms_empty_text {
    font-size: 14px;
}

/* Loading State */
.sms_loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}

/* Thread View */
#sms_thread_view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.sms_thread_header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
    flex-shrink: 0;
}

.sms_back_btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #0989BD;
    cursor: pointer;
    padding: 5px 10px;
    margin-right: 10px;
}

.sms_back_btn:hover {
    background: rgba(9, 137, 189, 0.1);
    border-radius: 4px;
}

.sms_thread_patient {
    flex: 1;
}

#sms_thread_name {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.sms_thread_phone_number {
    font-size: 12px;
    color: #6c757d;
}

/* Messages Container */
.sms_messages_container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

/* Message Bubbles */
.sms_message {
    max-width: 85%;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.sms_message.outbound {
    margin-left: auto;
    align-items: flex-end;
}

.sms_message.inbound {
    margin-right: auto;
    align-items: flex-start;
}

.sms_message_bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.sms_message.outbound .sms_message_bubble {
    background: linear-gradient(135deg, #0989BD, #077a9e);
    color: white;
    border-bottom-right-radius: 4px;
}

.sms_message.inbound .sms_message_bubble {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.sms_message_meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 11px;
    color: #999;
}

.sms_message_status {
    font-size: 10px;
    text-transform: uppercase;
}

.sms_message_status.sent {
    color: #6c757d;
}

.sms_message_status.delivered {
    color: #28a745;
}

.sms_message_status.failed {
    color: #dc3545;
}

/* Reply Box */
.sms_reply_box {
    padding: 12px 15px 20px 15px;
    border-top: 1px solid #e9ecef;
    background: #fff;
    flex-shrink: 0;
}

.sms_message_textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    resize: none;
    outline: none;
    min-height: 44px;
    max-height: 100px;
    box-sizing: border-box;
    font-family: inherit;
}

.sms_message_textarea:focus {
    border-color: #0989BD;
    box-shadow: 0 0 0 3px rgba(9, 137, 189, 0.1);
}

.sms_reply_footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.sms_char_count {
    font-size: 12px;
    color: #999;
}

.sms_char_count.warning {
    color: #ffc107;
}

.sms_char_count.danger {
    color: #dc3545;
}

.sms_send_button {
    padding: 8px 20px;
    background: linear-gradient(135deg, #0989BD, #077a9e);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.sms_send_button:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(9, 137, 189, 0.4);
}

.sms_send_button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Position search results relative to container */
#sms_conversation_list_view {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
