/* --------------------------------------------------
   GLOBAL BASE STYLES
-------------------------------------------------- */
body {
    font-family: 'Poppins', system-ui, sans-serif;
    background-color: #f8f9fa;
    height: 100%;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

/* --------------------------------------------------
   CORE COMPONENTS
-------------------------------------------------- */
.navbar-brand {
    font-size: 1.25rem;
}

.card {
    border-radius: 0.75rem;
}

footer {
    position: relative;
    bottom: 0;
    width: 100%;
    font-size: 0.85rem;
}

/* Table hover */
.table-hover tbody tr:hover {
    background-color: rgba(0,0,0,0.05);
}

/* --------------------------------------------------
   DASHBOARD LAYOUT
-------------------------------------------------- */
#sidebar {
    min-height: 100vh;
    overflow-y: auto;
    position: fixed;
    top: 0;
    left: 0;
}

#main-content {
    margin-left: 0;
    min-height: 100vh;
}

@media (min-width: 768px) {
    #main-content {
        margin-left: 250px;
    }
    #sidebar {
        width: 250px;
    }
}

#sidebar .nav-link {
    display: block;
    padding: 0.6rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.15s;
}
#sidebar .nav-link:hover,
#sidebar .nav-link.active {
    background-color: rgba(255,255,255,0.15);
    text-decoration: none;
}

/* --------------------------------------------------
   CHAT / SMS INTERFACE
-------------------------------------------------- */

/* Sidebar (conversation list) */
#conversation-list {
    min-height: 100vh;
    border-right: 1px solid rgba(0,0,0,0.1);
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}
#conversation-list h5 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}
#conv-items {
    margin-top: .5rem;
    padding-bottom: env(safe-area-inset-bottom);
}
#conv-items .conv-item {
    border-radius: .35rem;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background-color .15s ease-in-out;
}
#conv-items .conv-item:hover {
    background-color: rgba(0,0,0,0.05);
}
#conv-items .conv-item.active {
    background-color: rgba(0,0,0,0.1);
}
#conv-items .fw-semibold {
    font-size: 0.95rem;
}
#conv-items .small.text-secondary {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* --------------------------------------------------
   CHAT PANEL
-------------------------------------------------- */
#chat-panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
}
#chat-header {
    flex-shrink: 0;
    border-bottom: 1px solid #dee2e6;
}
#chat-messages {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 1rem;
}
#chat-messages::-webkit-scrollbar {
    width: 8px;
}
#chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.2);
    border-radius: 4px;
}

/* Message bubbles */
#chat-messages .text-start .bg-white {
    background-color: #ffffff !important;
}
#chat-messages .text-end .bg-primary {
    background-color: #0d6efd !important;
}
#chat-messages .d-inline-block {
    word-wrap: break-word;
    white-space: pre-wrap;
    border-radius: 0.75rem;
}
#chat-messages small.text-muted {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* MMS media */
#chat-messages img {
    border-radius: 0.5rem;
    display: block;
    margin-top: 0.25rem;
    max-width: 80%;
}
#chat-messages video {
    display: block;
    margin-top: 0.25rem;
    border-radius: 0.5rem;
    max-width: 80%;
}
#chat-messages a {
    text-decoration: none;
    word-break: break-all;
}

/* Send form */
#sendForm textarea {
    resize: none;
    overflow: hidden;
    min-height: 38px;
    max-height: 120px;
}
#sendForm button {
    padding-inline: 1.25rem;
}

/* --------------------------------------------------
   RESPONSIVE ADJUSTMENTS
-------------------------------------------------- */
@media (max-width: 767px) {
    #conversation-list {
        position: relative;
        width: 100%;
        height: auto;
        max-height: calc(100dvh - 100px);
        overflow-y: auto;
        border-right: none;
        background-color: #ffffff;
        transform: none;
    }
    #chat-panel {
        height: 100dvh;
    }
}

/* Conversation list items */
#conv-list .list-group-item {
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
}
#conv-list .list-group-item:hover {
    background-color: #f8f9fa;
    border-left: 4px solid #0d6efd;
}
#conv-list .fw-semibold {
    font-size: 1rem;
}
#conv-list .small {
    font-size: 0.8rem;
}

.select2-container--bootstrap-5 .select2-selection {
    min-height: calc(2.25rem + 2px);
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
}
.select2-container--bootstrap-5 .select2-selection__rendered {
    color: #212529;
}
/* --- Select2 Style Fix for Bootstrap 5 --- */
.select2-container--bootstrap-5 .select2-selection {
    border: 1px solid #ced4da !important;
    border-radius: 0.375rem !important;
    background-color: #fff !important;
    padding: 0.375rem 0.75rem !important;
    height: calc(2.25rem + 2px) !important;
    display: flex !important;
    align-items: center;
}

.select2-container--bootstrap-5 .select2-selection__rendered {
    color: #212529 !important;
    line-height: 1.5 !important;
    padding-left: 0 !important;
}

.select2-container--bootstrap-5 .select2-selection__arrow {
    height: 100% !important;
    right: 0.75rem !important;
}

.select2-container--bootstrap-5 .select2-selection__placeholder {
    color: #6c757d !important;
}

#charCount {
    font-size: 0.8rem;
    opacity: 0.85;
}

#mobile-notify {
    padding-bottom: 2rem;
}
#mobile-notify button {
    border-radius: 50px;
    padding-inline: 1.25rem;
}

#sendingSpinner .spinner-border {
    width: 3rem;
    height: 3rem;
}