/* =================================================================
   CHATAPP ADMIN - MAIN SHARED STYLES
   For common UI elements used across admin and agent interfaces
   ================================================================= */

/* =================================================================
   RESIZABLE COLUMNS & LAYOUT
   ================================================================= */
.inbox-container {
    position: relative;
}

.resizable-column {
    position: relative;
    display: flex;
    flex-direction: column;
}

.resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 6px;
    background: transparent;
    cursor: col-resize;
    z-index: 10;
    transition: background-color 0.2s ease;
}

.resize-handle-right {
    right: -1px;
}

.resize-handle-left {
    left: -1px;
}

.resize-handle:hover {
    background-color: #2196f3;
    opacity: 0.7;
}

.resize-handle:active {
    background-color: #1976d2;
    opacity: 1;
}

.resize-handle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 30px;
    background-color: #ddd;
    border-radius: 1px;
    transition: background-color 0.2s ease;
}

.resize-handle:hover::before {
    background-color: white;
}

/* Resizing state */
.resizing {
    user-select: none;
    pointer-events: none;
}

.resizing .resize-handle {
    background-color: #2196f3;
    opacity: 1;
}

/* Full height layout */
.inbox-container .card {
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Scrollable areas */
#conversations-list {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    padding-top:5px;
}

#conversations-list::-webkit-scrollbar {
    width: 6px;
}

#conversations-list::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

#conversations-list::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

#conversations-list::-webkit-scrollbar-thumb:hover {
    background-color: #aaa;
}

.messages-container {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background-color: #aaa;
}

#conversation-details {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

#conversation-details::-webkit-scrollbar {
    width: 6px;
}

#conversation-details::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

#conversation-details::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

#conversation-details::-webkit-scrollbar-thumb:hover {
    background-color: #aaa;
}

/* =================================================================
   NAVIGATION & BRANDING
   ================================================================= */

.navbar-brand-autodark { 
    opacity: 1 !important; 
}

/* =================================================================
   CONVERSATIONS LIST
   ================================================================= */
.conversation-item {
    cursor: pointer;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
}

.conversation-item:hover {
    background-color: #f8f9fa;
}

/* Support both .active and .selected for backwards compatibility */
.conversation-item.active,
.conversation-item.selected {
    background-color: #e3f2fd;
    border-left-color: #2196f3;
}

/* =================================================================
   MESSAGE BUBBLES
   ================================================================= */
.message-bubble {
    max-width: 70%;
    margin: 5px 0;
    padding: 8px 12px;
    border-radius: 15px;
    word-wrap: break-word;
    position: relative;
}

.message-agent {
    background-color: rgb(206, 226, 253);
    color: rgb(26, 26, 26);
    border: 1px solid rgb(206, 226, 253);
    margin-left: auto;
    text-align: right;
}

.message-customer {
    background-color: rgb(240, 241, 239);
    color: rgb(26, 26, 26);
    border: 1px solid rgb(240, 241, 239);
    margin-right: auto;
    text-align: left;
}

.message-internal-comment {
    background-color: rgb(254, 231, 154) !important;
    color: rgb(26, 26, 26) !important;
    border: 1px solid rgb(254, 231, 154) !important;
    margin-left: auto;
    text-align: right;
    max-width: 70% !important;
    font-size: inherit !important;
    padding: 8px 12px !important;
    word-wrap: break-word !important;
    display: inline-block !important;
    width: auto !important;
}

.message-system {
    background-color: #e9ecef;
    color: #6c757d;
    margin: 12px auto;
    text-align: center;
    font-style: italic;
    font-size: 12px;
    max-width: 60%;
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

/* =================================================================
   MESSAGE EDITING
   ================================================================= */
.message-edit-icon {
    /* background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    padding: 4px; */
    transition: all 0.2s ease;
    color: #666;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-edit-icon:hover {
    /* background-color: rgba(255, 255, 255, 1); */
    color: #333;
    transform: scale(1.1);
}

.message-bubble.bg-primary .message-edit-icon,
.message-agent .message-edit-icon {
    background-color: rgba(255, 255, 255, 0.9);
    color: rgb(26, 26, 26);
}

.message-bubble.bg-primary .message-edit-icon:hover,
.message-agent .message-edit-icon:hover {
    background-color: rgba(255, 255, 255, 1);
    color: rgb(26, 26, 26);
}

.message-text textarea {
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    color: #000 !important;
    border-radius: 6px;
    padding: 8px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
}

.message-text textarea:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.message-text .btn-sm {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
}

/* =================================================================
   COLUMN LAYOUT WIDTHS
   ================================================================= */
.column-conversations {
    width: 350px;
    min-width: 350px;
}

.column-messages {
    flex: 1;
    min-width: 0;
}

.column-details {
    width: 300px;
    min-width: 300px;
}

/* =================================================================
   TABLES
   ================================================================= */
.table th {
    font-weight: 600;
    background-color: #f8f9fa;
}

.table-vcenter td {
    vertical-align: middle;
}

/* =================================================================
   CARDS
   ================================================================= */
.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* =================================================================
   RESPONSIVE ADJUSTMENTS
   ================================================================= */
@media (max-width: 768px) {
    .inbox-container {
        flex-direction: column;
        height: auto;
    }
    
    .resizable-column {
        width: 100% !important;
        min-width: auto !important;
        max-width: none !important;
        flex: none !important;
    }
    
    .resize-handle {
        display: none;
    }
    
    .column-conversations,
    .column-details {
        width: 100%;
        min-width: auto;
    }
    
    .messages-container {
        height: 300px;
    }
}

/* =================================================================
   LOADING STATES
   ================================================================= */
.spinner-border {
    color: #2196f3;
}

/* =================================================================
   TOAST NOTIFICATIONS
   ================================================================= */
.alert {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* =================================================================
   STATUS BADGES
   ================================================================= */
.badge {
    font-size: 0.75em;
    padding: 0.375rem 0.5rem;
}

.badge-sm {
    font-size: 0.65em;
    padding: 0.25rem 0.375rem;
}

/* Larger status badges for prominent display */
.conversation-item .badge {
    font-size: 0.8em;
    padding: 0.4rem 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Override conversation badge size when badge-sm is used */
.conversation-item .badge.badge-sm {
    font-size: 0.65em !important;
    padding: 0.25rem 0.375rem !important;
}

/* Status badge colors */
.badge-success {
    background-color: #28a745;
    color: white;
}

.badge-secondary {
    background-color: #6c757d;
    color: white;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-info {
    background-color: #17a2b8;
    color: white;
}

/* =================================================================
   NAVIGATION LINKS
   ================================================================= */
.nav-link.active {
    font-weight: 600;
}

/* =================================================================
   INPUT GROUPS
   ================================================================= */
.input-group-append .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* =================================================================
   ACTION BUTTONS & DROPDOWNS
   ================================================================= */
.card-actions .btn {
    margin-left: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.card-actions .btn svg {
    margin-right: 0.25rem;
}

/* Dropdown menus */
.card-actions .dropdown-menu {
    min-width: 200px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.card-actions .dropdown-item {
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.card-actions .dropdown-item:hover {
    background-color: #f8fafc;
    color: #374151;
}

.card-actions .dropdown-item:active {
    background-color: #e5e7eb;
}

/* =================================================================
   UTILITY CLASSES
   ================================================================= */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =================================================================
   FILE UPLOAD & DRAG/DROP
   ================================================================= */
.card-footer.drag-active {
    background-color: #e3f2fd !important;
    border: 2px dashed #2196f3 !important;
    box-shadow: inset 0 0 10px rgba(33, 150, 243, 0.1);
    transition: all 0.2s ease;
}

#message-input-container.drag-active {
    background-color: #e3f2fd !important;
    border: 2px dashed #2196f3 !important;
    border-radius: 8px;
    transition: all 0.2s ease;
}

#drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(33, 150, 243, 0.1);
    border: 2px dashed #2196f3;
    border-radius: 8px;
    display: none;
    z-index: 1000;
    pointer-events: none;
}

#drag-overlay::before {
    content: "Drop files here to upload";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    color: #2196f3;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* File preview styles */
.file-preview-item {
    transition: all 0.2s ease;
}

.file-preview-item:hover {
    background-color: #f0f0f0 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#file-status {
    font-size: 0.875rem;
    color: #666;
    padding: 4px 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

/* Multiple file selection support */
.input-group input[type="file"][multiple] {
    cursor: pointer;
}

.input-group input[type="file"][multiple]::-webkit-file-upload-button {
    cursor: pointer;
}

/* =================================================================
   FOOTER & INTERACTIVE ELEMENTS
   ================================================================= */
.footer {
    padding-top: 16px !important;
    padding-bottom: 16px !important;
}

/* Interactive badge styling for buttons */
.badge[style*="cursor: pointer"],
#emoji-button,
span[onclick*="file-input"] {
    transition: all 0.2s ease;
    user-select: none;
}

.badge[style*="cursor: pointer"]:hover,
#emoji-button:hover,
span[onclick*="file-input"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    opacity: 0.9;
}

.badge[style*="cursor: pointer"]:active,
#emoji-button:active,
span[onclick*="file-input"]:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Ensure consistent badge appearance */
.badge.badge-secondary {
    background-color: #6c757d !important;
    color: white !important;
}



/* =================================================================
   BUTTON SIZING & BADGE INTERACTIONS
   ================================================================= */
.card-actions .btn-sm {
    padding: 0.375rem 0.75rem !important;
    font-size: 0.875rem !important;
    line-height: 1.25 !important;
    border-radius: 0.2rem !important;
}

.card-actions .btn-sm .icon {
    width: 18px !important;
    height: 18px !important;
}

/* Badge buttons styling */
.card-actions .badge {
    cursor: pointer !important;
    user-select: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.card-actions .badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.card-actions .badge:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card-actions .badge .icon {
    width: 14px !important;
    height: 14px !important;
} 