/* ─── Aserva Inbox Styles ─────────────────────────────────────────────── */

.aserva-inbox-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 0;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    overflow: hidden;
    min-height: 600px;
}

/* ── List Panel ─────────────────────────────────────────────────────── */

.aserva-inbox-list {
    border-right: 1px solid #dcdcde;
    display: flex;
    flex-direction: column;
}

.aserva-inbox-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.aserva-inbox-select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
}

.aserva-inbox-items {
    flex: 1;
    overflow-y: auto;
}

.aserva-inbox-loading {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}

/* Conversation Row */
.aserva-inbox-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.15s;
}

.aserva-inbox-item:hover {
    background: #f9fafb;
}

.aserva-inbox-item.active {
    background: #fff7ed;
    border-left: 3px solid #f97316;
}

.aserva-inbox-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aserva-inbox-item-name {
    font-weight: 600;
    font-size: 14px;
    color: #111;
}

.aserva-inbox-item-time {
    font-size: 11px;
    color: #9ca3af;
}

.aserva-inbox-item-preview {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aserva-inbox-item-meta {
    display: flex;
    gap: 8px;
    align-items: center;
}

.aserva-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.aserva-badge-open {
    background: #dcfce7;
    color: #166534;
}

.aserva-badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.aserva-badge-closed {
    background: #f3f4f6;
    color: #6b7280;
}

/* ── Detail Panel ───────────────────────────────────────────────────── */

.aserva-inbox-detail {
    display: flex;
    flex-direction: column;
}

.aserva-inbox-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    gap: 12px;
}

.aserva-empty-icon {
    font-size: 48px;
    opacity: 0.5;
}

/* Detail Header */
.aserva-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.aserva-detail-title {
    font-size: 16px;
    font-weight: 700;
    color: #111;
}

.aserva-detail-actions {
    display: flex;
    gap: 8px;
}

.aserva-detail-actions .button {
    font-size: 12px;
    padding: 4px 12px;
}

/* Messages Thread */
.aserva-detail-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aserva-message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.aserva-message-customer {
    align-self: flex-start;
    background: #f3f4f6;
    color: #374151;
    border-bottom-left-radius: 4px;
}

.aserva-message-agent {
    align-self: flex-end;
    background: #f97316;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.aserva-message-ai {
    align-self: flex-end;
    background: #dbeafe;
    color: #1e40af;
    border-bottom-right-radius: 4px;
}

.aserva-message-meta {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

/* Reply Box */
.aserva-detail-reply {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.aserva-reply-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
}

.aserva-reply-textarea:focus {
    border-color: #f97316;
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.aserva-reply-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.aserva-ai-draft-btn {
    background: none;
    border: 1px solid #dbeafe;
    color: #2563eb;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.aserva-ai-draft-btn:hover {
    background: #dbeafe;
}

/* Customer Sidebar (within detail) */
.aserva-customer-sidebar {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}

.aserva-customer-sidebar h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 12px;
}

.aserva-customer-field {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 4px 0;
    color: #374151;
}

.aserva-customer-field span:first-child {
    color: #9ca3af;
}

/* Responsive */
@media (max-width: 960px) {
    .aserva-inbox-container {
        grid-template-columns: 1fr;
    }
    .aserva-inbox-list {
        border-right: none;
        border-bottom: 1px solid #dcdcde;
        max-height: 300px;
    }
}
