/* WAPrimeDesk Admin Styles */
.waprimedesk-wrap {
    margin: 0;
    padding: 10px 0 0 0;
    max-height: 100vh;
    overflow: hidden;
}

.waprimedesk-wrap .waprimedesk-layout {
    margin: 0;
}

.waprimedesk-layout {
    display: flex;
    height: calc(100vh - 120px);
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    margin: 10px 0 0 0;
}

/* Conversations Panel */
.conversations-panel {
    flex: 0 0 32%;
    max-width: 32%;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.conversations-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversations-header h2 {
    margin: 0;
    font-size: 18px;
    color: #23282d;
}

.conversations-controls {
    display: flex;
    gap: 5px;
}

.conversations-controls .button {
    padding: 4px 8px;
    font-size: 12px;
    height: auto;
    line-height: 1.4;
}

.conversation-overview {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-wrap: wrap;
}

.overview-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.overview-chip .chip-count {
    color: #111827;
}

.conversation-filter-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 15px;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
    position: relative;
}

.conversation-status-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    background: #fffdf5;
    padding: 6px;
    border-radius: 10px;
    border: 1px solid #ffe8c4;
}

.conversation-status-tab {
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    flex: 1;
    min-width: 0;
    justify-content: center;
}

.conversation-status-tab .tab-count {
    background: #f3f4f6;
    border-radius: 999px;
    padding: 1px 6px;
    font-weight: 700;
    color: #1f2937;
    font-size: 10px;
}

.conversation-status-tab.is-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.conversation-status-tab.is-active .tab-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.whatsapp-settings-section .category-manager {
    margin-top: 12px;
    border: 1px solid #e5e7eb;
    padding: 12px;
    border-radius: 8px;
    background: #fff;
}

.category-manager-table th,
.category-manager-table td {
    padding: 6px 8px;
    vertical-align: top;
}

.category-manager-table input {
    width: 100%;
    box-sizing: border-box;
}

.category-manager-table td:nth-child(4) {
    width: 90px;
}

.category-color {
    width: 56px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    padding: 0;
    cursor: pointer;
}

.category-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.category-manager-status {
    margin-top: 10px;
    min-height: 1.4em;
    font-size: 13px;
    font-weight: 600;
}

.category-manager-status.success {
    color: #047857;
}

.category-manager-status.error {
    color: #b91c1c;
}

.category-empty-row td {
    text-align: center;
    color: #6b7280;
}

.conversation-category-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px;
    border-radius: 10px;
    background: #ecf2ff;
    border: 1px solid #dbe3ff;
}

.conversation-category-tab {
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    flex: 0 1 auto;
    min-width: 0;
    justify-content: center;
}

.conversation-category-tab .tab-count {
    background: #f3f4f6;
    border-radius: 999px;
    padding: 1px 6px;
    font-weight: 700;
    color: #1f2937;
    font-size: 10px;
}

.conversation-category-tab.is-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.conversation-category-tab.is-active .tab-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.new-message-toast {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, 10px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.25);
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.new-message-toast.is-visible {
    display: inline-flex;
    opacity: 1;
    transform: translate(-50%, 0);
}

.filter-controls {
    display: flex;
    gap: 8px;
    align-items: stretch;
    min-width: 0;
    overflow: hidden;
}

.filter-group input[type="search"],
.filter-group select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    background: #fff;
    color: #1f2937;
    transition: all 0.2s ease;
}

.filter-group input[type="search"] {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.35-4.35"></path></svg>');
    background-repeat: no-repeat;
    background-position: 10px center;
    padding-left: 36px;
}

.filter-group select {
    padding-right: 32px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23666" d="M6 9L1 4h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.filter-group input[type="search"]:focus,
.filter-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-group input[type="search"]:hover,
.filter-group select:hover {
    border-color: #9ca3af;
}

.search-group {
    flex: 1 1 auto;
    min-width: 0;
}

.search-group input[type="search"] {
    width: 100%;
}

.category-group {
    flex: 0 1 auto;
    min-width: 140px;
    max-width: 180px;
}

.category-group select {
    width: 100%;
    min-width: 0;
}

#conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: #ffffff;
}

.conversation-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.conversation-item.active {
    background-color: #eff6ff;
}

.conversation-item.active::before {
    background: #3b82f6;
}

.conversation-item.conversation-reopened::before {
    background: #f59e0b;
}

.conversation-item.conversation-reopened.active::before {
    background: linear-gradient(to bottom, #f59e0b 0%, #3b82f6 100%);
}

.conversation-details {
    flex: 1;
    min-width: 0;
}

.conversation-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: nowrap;
    margin-bottom: 8px;
}

.conversation-sender {
    font-weight: 600;
    font-size: 13.5px;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.conversation-category-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 6px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.01em;
}

.thread-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 6px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.conversation-activity-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 6px;
    background: #fef3c7;
    color: #92400e;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.thread-list {
    margin-top: 10px;
    padding: 10px 0 6px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid #e5e7eb;
    border-left: 2px solid #cbd5e1;
    background: linear-gradient(to right, #f8fafc 0%, transparent 100%);
    border-radius: 0 0 0 6px;
}

.thread-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: none;
    background: #f3f4f6;
    padding: 0.35rem 0.85rem;
    border-radius: 8px;
    font-size: 0.78rem;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.thread-item.thread-main {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #94a3b8;
    padding: 0.45rem 0.9rem;
    font-weight: 600;
}

.thread-item.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.thread-label {
    font-weight: 600;
}

.thread-preview {
    flex: 1;
    font-size: 0.74rem;
    color: rgba(15, 23, 42, 0.8);
}

.thread-time {
    font-size: 0.7rem;
    color: rgba(55, 65, 81, 0.8);
}

.thread-unread-badge,
.thread-activity-badge {
    font-size: 0.63rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
}

.thread-unread-badge {
    background: #dc2626;
    color: #fff;
}

.thread-activity-badge {
    background: #fde047;
    color: #92400e;
}

.thread-status-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.thread-item.active .thread-status-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Multi-level thread hierarchy styles */
.thread-category-group {
    margin-top: 0.5rem;
    padding-left: 0.75rem;
    border-left: 2px solid #cbd5e1;
    position: relative;
}

.thread-category-group::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #3b82f6 0%, transparent 100%);
    opacity: 0.3;
}

.thread-item.thread-subtype {
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    background: #f8fafc;
    border-left: 2px solid #cbd5e1;
    border-radius: 6px;
}

.thread-item.thread-subtype.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-left-color: #1e40af;
    box-shadow: 0 1px 6px rgba(37, 99, 235, 0.2);
}

.thread-item.thread-subtype .thread-label {
    font-weight: 500;
}

.thread-item:hover {
    background: #e5e7eb;
    transform: translateX(2px);
}

.thread-item.thread-main:hover {
    background: #f9fafb;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.thread-item.active:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.thread-item.thread-subtype:hover {
    background: #f1f5f9;
    border-left-color: #94a3b8;
}

.thread-item.thread-subtype.active:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.unread-badge {
    background: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

.conversation-meta {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.conversation-time {
    font-size: inherit;
    color: inherit;
}

.conversation-actions {
    opacity: 0;
    transition: opacity 0.2s;
}

.conversation-item:hover .conversation-actions {
    opacity: 1;
}

.delete-conversation {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.delete-conversation:hover {
    background: #dc3545;
    color: white;
}

.no-conversations {
    padding: 40px 20px;
    text-align: center;
    color: #666;
}

/* Chat Panel */
.chat-panel {
    flex: 1 1 48%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #ddd;
}

.actions-panel {
    flex: 0 0 20%;
    max-width: 20%;
    display: flex;
    flex-direction: column;
    background: #fdfdfd;
    border-left: 1px solid #ddd;
}

.is-hidden {
    display: none !important;
}

.actions-header {
    padding: 20px;
    border-bottom: 1px solid #ececec;
    background: #fff;
}

.actions-header h2 {
    margin: 0;
    font-size: 18px;
    color: #23282d;
}

.actions-context {
    margin: 8px 0 0;
    font-size: 13px;
    color: #666;
}

.actions-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.actions-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #888;
    padding: 20px;
    border: 1px dashed #d0d7de;
    border-radius: 8px;
    background: #fdfdff;
}

.actions-placeholder .dashicons {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.actions-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.action-group h3 {
    margin: 0 0 12px;
    font-size: 14px;
    color: #23282d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-pill,
.conversation-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
    padding: 6px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.conversation-status-badge {
    flex-shrink: 0;
    margin-left: auto;
    align-self: center;
}

.conversation-sender-text {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.conversation-sender-number {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-select-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #555;
}

.status-select {
    width: 100%;
    border-radius: 6px;
    border: 1px solid #d0d7de;
    padding: 8px 10px;
    background: #fff;
    font-size: 13px;
    color: #23282d;
}

.status-select:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.status-new {
    background: #e3f2fd;
    color: #0b5cab;
}

.status-active {
    background: #e8f5e9;
    color: #1b5e20;
}

.status-closed {
    background: #f3e5f5;
    color: #4a148c;
}

.status-expired {
    background: #fff3e0;
    color: #bf360c;
}

.assigned-member-display {
    padding: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.assigned-member-info .no-assignment {
    color: #6b7280;
    font-size: 13px;
    font-style: italic;
}

.assigned-member-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    color: #1e40af;
    font-weight: 500;
    font-size: 13px;
}

.assigned-member-badge .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #2563eb;
}

.assigned-member-badge .member-name {
    flex: 1;
}

.assignment-controls {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.assignment-controls select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    background-color: #ffffff;
    cursor: pointer;
}

.assignment-controls select:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    color: #9ca3af;
}

.assignment-controls .button {
    padding: 6px 16px;
    height: auto;
    font-size: 13px;
    line-height: 1.4;
}

.assignment-helper {
    margin-top: 6px;
    font-size: 12px;
    color: #6b7280;
}

.collaboration-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#notify-agent-select {
    width: 100%;
}

.notes-history {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fafafa;
    flex: 1;
    min-height: 180px;
}

.notes-history .no-notes {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
    margin: 0;
}

.note-item {
    padding: 12px 15px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.note-item:last-child {
    border-bottom: none;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.note-author {
    font-weight: 600;
    font-size: 12px;
    color: #2563eb;
}

.note-timestamp {
    font-size: 11px;
    color: #999;
}

.note-content {
    font-size: 13px;
    color: #23282d;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.add-note-section {
    margin-top: 15px;
}

.add-note-section textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    color: #23282d;
    background: #fff;
    font-family: inherit;
}

.add-note-section textarea:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    pointer-events: none;
}

.add-note-section textarea:not(:disabled) {
    pointer-events: auto;
    cursor: text;
}

.add-note-section textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
}

.note-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.notes-group .description {
    margin: 8px 0 0;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.notes-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.coming-soon {
    margin: 4px 0 0;
    font-size: 12px;
    color: #999;
    font-style: italic;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
}

.chat-contact-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.view-history-button {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    padding: 0;
}

.view-history-button:hover,
.view-history-button:focus {
    color: #1d4ed8;
    outline: none;
}

.chat-category-badge {
    display: none;
    background: #eef2ff;
    color: #3730a3;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.chat-thread-badge {
    display: none;
    background: #fdf4ff;
    color: #701a75;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.contact-details h3 {
    margin: 0;
    font-size: 16px;
    color: #23282d;
}

.contact-status {
    font-size: 12px;
    color: #666;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.no-conversation-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #666;
}

.welcome-message .dashicons {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.welcome-message h3 {
    margin: 0 0 8px 0;
    color: #23282d;
}

.welcome-message p {
    margin: 0;
    color: #666;
}

.message-bubble {
    max-width: 70%;
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
}

.message-received {
    background: #e9ecef;
    color: #23282d;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message-sent {
    background: #2196f3;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message-system {
    background: #fffbe6;
    color: #4b5563;
    border: 1px dashed #fbbf24;
    border-radius: 12px;
    margin: 0 auto 15px;
    display: block;
    max-width: 60%;
    text-align: center;
}

.message-system-summary {
    font-weight: 600;
}

.message-system-details {
    margin-top: 6px;
    font-size: 11px;
    color: #6b7280;
    line-height: 1.4;
    word-break: break-word;
}

.message-pending {
    opacity: 0.6;
}

.message-system.message-sent {
    margin-left: auto;
    margin-right: auto;
}

.message-meta-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 6px;
}

.message-bubble.message-system .message-content {
    font-size: 13px;
}

.message-bubble.message-system .message-time {
    text-align: center;
    color: #6b7280;
}

.message-content {
    margin-bottom: 4px;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
}

.message-received .message-time {
    text-align: left;
}

.chat-input {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    background: #fff;
}

.chat-input-hidden,
.chat-input.is-hidden {
    display: none;
}

.input-container {
    display: flex;
    align-items: end;
    gap: 10px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 8px 12px;
}

#message-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px;
    padding: 8px 0;
}

#send-message {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #2196f3;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

#send-message:hover {
    background: #1976d2;
}

#send-message:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.auto-refresh-active {
    background-color: #46b450 !important;
    border-color: #46b450 !important;
    color: white !important;
}

.update-info {
    margin: 10px 0 0 0;
    padding: 0;
    text-align: right;
    font-size: 12px;
    color: #666;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.error {
    color: #dc3545;
    padding: 20px;
    text-align: center;
}

.no-messages {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

/* Settings Page Styles */
.waprimedesk-settings-notice {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 5px;
    padding: 15px;
    margin: 20px 0;
}

.waprimedesk-settings-notice h3 {
    margin-top: 0;
    color: #0073aa;
}

.waprimedesk-settings-notice ol {
    margin: 10px 0 0 20px;
}

.waprimedesk-settings-notice li {
    margin-bottom: 5px;
}

.waprimedesk-settings-sections {
    display: grid;
    gap: 30px;
}

.waprimedesk-settings-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.waprimedesk-settings-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #23282d;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.required {
    color: #d63638;
    font-weight: bold;
}

.waprimedesk-settings-actions {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: center;
}

.waprimedesk-settings-actions .button {
    margin-right: 10px;
    min-width: 120px;
}

.connection-status {
    margin-left: 15px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 3px;
    display: inline-block;
}

.connection-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.connection-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.connection-status.testing {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Modal styles */
.whatsapp-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
}

.whatsapp-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 60%;
    max-width: 700px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
    border-radius: 5px;
}

.whatsapp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.whatsapp-modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.whatsapp-modal-close:hover {
    color: black;
}

.whatsapp-modal-body {
    padding: 20px 0;
}

.whatsapp-modal-footer {
    padding-top: 10px;
    border-top: 1px solid #ddd;
    text-align: right;
}

#test-results-content {
    min-height: 100px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 3px;
    white-space: pre-wrap;
    font-family: monospace;
}

/* Team Members */
.team-members-page .wp-heading-inline {
    margin-right: 10px;
}

.team-members-page .team-members-description {
    margin-top: 12px;
    max-width: 680px;
}

.team-members-page #add-team-member {
    vertical-align: middle;
}

.team-members-table {
    margin-top: 20px;
}

.team-members-table .column-actions button + button {
    margin-left: 6px;
}

.action-group.assigned-member-group .assignment-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.action-group.assigned-member-group .assignment-controls select {
    width: 220px;
    max-width: 100%;
}

.action-group.assigned-member-group .assignment-controls .button {
    margin: 0;
}

.team-member-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.team-member-status.status-active {
    background: #dcfce7;
    color: #166534;
}

.team-member-status.status-inactive {
    background: #fee2e2;
    color: #b91c1c;
}

.team-members-notice {
    margin: 12px 0;
    padding: 10px 15px;
    display: none;
}

.team-member-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.team-member-modal__content {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    width: 600px;
    max-width: 90%;
    position: relative;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.25);
}

.team-member-modal__content h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f2937;
}

.team-member-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
}

.team-member-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.team-member-form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.team-member-form-field input,
.team-member-form-field select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 8px;
}

.team-member-category-panel {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 15px;
}

.team-member-category-panel .description {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #6b7280;
}

.team-member-category-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-member-category-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.team-member-category-option input[type="checkbox"] {
    width: auto;
    height: auto;
    margin: 0;
}

.team-member-form-field.checkbox-field {
    grid-column: 1;
}

.team-member-form-field.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

.team-member-form-field.checkbox-field input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.team-member-form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    .waprimedesk-layout {
        flex-direction: column;
        height: auto;
    }
    
    .conversations-panel,
    .chat-panel,
    .actions-panel {
        width: 100%;
    }
    
    .conversations-panel {
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .conversation-overview,
    .conversation-filter-bar {
        padding: 12px;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-group,
    .category-group select {
        width: 100%;
    }
    
    .chat-panel {
        min-height: 400px;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .actions-panel {
        max-width: 100%;
        border-left: none;
        border-top: 1px solid #ddd;
    }
    
    .whatsapp-modal-content {
        width: 90%;
        margin: 10% auto;
    }
}
